mirror of
https://github.com/fcwu/docker-ubuntu-vnc-desktop
synced 2025-12-09 09:55:31 +01:00
Added stability
This commit is contained in:
parent
063186e277
commit
88644b03e5
1 changed files with 14 additions and 12 deletions
|
|
@ -4,26 +4,28 @@ DIR=$(pwd)
|
|||
|
||||
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
|
||||
echo "Wait for dbus to start."
|
||||
until PID=$(pgrep xfce4-session); do
|
||||
echo "Rechecking dbus"
|
||||
sleep 1
|
||||
done
|
||||
done
|
||||
|
||||
# Export DBUS Variable
|
||||
echo "DBUS Address: $DBUS_ADDRESS"
|
||||
export DBUS_SESSION_BUS_ADDRESS="unix:abstract=$DBUS_ADDRESS"
|
||||
echo "DBUS PID: $PID"
|
||||
sleep 5
|
||||
|
||||
# Loop and check if its time to update the background
|
||||
while true; do
|
||||
PID=$(pgrep xfce4-session)
|
||||
DBUS_SESSION_BUS_ADDRESS=$(grep -z DBUS_SESSION_BUS_ADDRESS /proc/$PID/environ | cut -d= -f2- | tr -d '\0')
|
||||
export DBUS_SESSION_BUS_ADDRESS
|
||||
FILE_COUNT=$(ls *.jpg | wc -l)
|
||||
IMAGE_NUMBER=$(bc -l <<< "x=( $(date +%H) / ( 24 / $FILE_COUNT )); scale=0; x/1+1")
|
||||
FILE=$(ls -1 *.jpg | sed "${IMAGE_NUMBER}q;d")
|
||||
FILE=$DIR/$(ls -1 *.jpg | sed "${IMAGE_NUMBER}q;d")
|
||||
OLD_FILE=$(xfconf-query -c xfce4-desktop -p /backdrop/screen0/monitorscreen/workspace0/last-image)
|
||||
if [[ $FILE != $OLD_FILE ]]; then
|
||||
echo "Setting new background to $FILE"
|
||||
xfconf-query -c xfce4-desktop -p /backdrop/screen0/monitorscreen/workspace0/last-image -n -t string -s $DIR/$FILE
|
||||
OLD_FILE=$FILE
|
||||
echo "Changing background from $OLD_FILE to $FILE"
|
||||
xfconf-query -c xfce4-desktop -p /backdrop/screen0/monitorscreen/workspace0/last-image -n -t string -s $FILE
|
||||
OLD_FILEx=$FILE
|
||||
fi
|
||||
sleep 60
|
||||
done
|
||||
Loading…
Reference in a new issue