Skip to content

Instantly share code, notes, and snippets.

@awls99
Last active July 28, 2024 22:44
Show Gist options
  • Select an option

  • Save awls99/7d27f66f3e0e9d965ca4f49ebc2d0dde to your computer and use it in GitHub Desktop.

Select an option

Save awls99/7d27f66f3e0e9d965ca4f49ebc2d0dde to your computer and use it in GitHub Desktop.
Ubuntu random wallpaper
#!/bin/sh
# */5 * * * * /bin/sh /home/arthur/wallpaperShuffle.sh > /tmp/cronjob.log 2>&1
REAL_UID=$(id --real --user)
PID=$(pgrep --euid $REAL_UID gnome-session | head -n 1)
export DBUS_SESSION_BUS_ADDRESS=$(grep -z DBUS_SESSION_BUS_ADDRESS /proc/$PID/environ|cut -d= -f2- | sed -e "s/\x0//g")
PIC=$(ls /media/arthur/Fast\ Stuff/Cloudbox/Ultrawide\ wallpapers/* | shuf -n1 )
echo $PIC > /home/arthur/log
gsettings set org.gnome.desktop.background picture-uri "file://$PIC"
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment