Skip to content

Instantly share code, notes, and snippets.

@Endika
Last active November 2, 2017 11:09
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save Endika/f50fd9dae95be30493b62e1352b9eb51 to your computer and use it in GitHub Desktop.
Save Endika/f50fd9dae95be30493b62e1352b9eb51 to your computer and use it in GitHub Desktop.
#!/bin/bash -e
user=$(whoami)
fl=$(find /proc -maxdepth 2 -user $user -name environ -print -quit)
for i in {1..5}
do
fl=$(find /proc -maxdepth 2 -user $user -name environ -newer "$fl" -print -quit)
done
export DBUS_SESSION_BUS_ADDRESS=$(grep -z DBUS_SESSION_BUS_ADDRESS "$fl" | cut -d= -f2-)
PICS_PATH="/home/endika/Dropbox/wallpapers/"
IMG=$(find -L $PICS_PATH -name "*.jpg" -o -name "*.png" | shuf -n1)
# gsettings set org.gnome.desktop.background picture-uri "file://${IMG}"
dconf write "/org/gnome/desktop/background/picture-uri" "'file://${IMG}'"
echo -e "$(date): ${IMG}" >> /tmp/wallch.log
# crontab
# * * * * * bash ~/Dropbox/random-background.sh
# * * * * * sleep 10 ; bash ~/Dropbox/random-background.sh
# * * * * * sleep 20 ; bash ~/Dropbox/random-background.sh
# * * * * * sleep 30 ; bash ~/Dropbox/random-background.sh
# * * * * * sleep 40 ; bash ~/Dropbox/random-background.sh
# * * * * * sleep 50 ; bash ~/Dropbox/random-background.sh
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment