mirror of
https://github.com/fcwu/docker-ubuntu-vnc-desktop
synced 2025-12-08 01:15:38 +01:00
fixing time calculation to background image
This commit is contained in:
parent
5f35f7b731
commit
9f225254b9
1 changed files with 9 additions and 7 deletions
|
|
@ -2,21 +2,23 @@ OLD_FILE=""
|
|||
DBUS_FILE="/var/log/dbus.txt"
|
||||
DIR=$(pwd)
|
||||
|
||||
# Wait until dbus is listening and delay 5 seconds for it to fully start.
|
||||
export DISPLAY=:1.0
|
||||
|
||||
# Wait until dbus is listening.
|
||||
until [[ $SUCCESS == "TRUE" ]]; do
|
||||
SUCCESS="FALSE"
|
||||
if test -f "$DBUS_FILE"; then SUCCESS="TRUE"; DBUS_ADDRESS=$(cat $DBUS_FILE); fi
|
||||
#sleep 1
|
||||
echo "DBUS Address: $DBUS_ADDRESS"
|
||||
export DBUS_SESSION_BUS_ADDRESS="unix:abstract=$DBUS_ADDRESS"
|
||||
export DISPLAY=:1.0
|
||||
sleep 1
|
||||
done
|
||||
|
||||
# Export DBUS Variable
|
||||
echo "DBUS Address: $DBUS_ADDRESS"
|
||||
export DBUS_SESSION_BUS_ADDRESS="unix:abstract=$DBUS_ADDRESS"
|
||||
|
||||
# Loop and check if its time to update the background
|
||||
while true; do
|
||||
echo $(date)
|
||||
FILE_COUNT=$(ls *.jpg | wc -l)
|
||||
IMAGE_NUMBER=$(bc -l <<< "x=( $(date +%H) / ( 24 / $FILE_COUNT )); scale=0; x/1")
|
||||
IMAGE_NUMBER=$(bc -l <<< "x=( $(date +%H) / ( 24 / $FILE_COUNT )); scale=0; x/1+1")
|
||||
FILE=$(ls -1 *.jpg | sed "${IMAGE_NUMBER}q;d")
|
||||
if [[ $FILE != $OLD_FILE ]]; then
|
||||
echo "Setting new background to $FILE"
|
||||
|
|
|
|||
Loading…
Reference in a new issue