gnome-shell-cycle-wallpaper.sh (626B)
1 #!/usr/bin/env sh 2 # cycles the desktop background to a random image from $XDG_PICTURES_DIR/wallpapers 3 # updated to work with Ubuntu 22 4 5 . "$HOME/.config/user-dirs.dirs" 6 WALLPAPERS_DIR=$XDG_PICTURES_DIR/wallpapers/ 7 8 if [ "$1" = "-h" ] || [ "$1" = "--help" ]; then 9 echo "usage: ./gnome-shell-cycle-wallpaper.sh" 10 echo "" 11 echo "change the wallpaper on a GNOME desktop to a random file from $WALLPAPERS_DIR" 12 exit 13 fi 14 15 selection=$(find "$WALLPAPERS_DIR" -type f | shuf -n1) 16 gsettings set org.gnome.desktop.background picture-uri "file://$selection" 17 gsettings set org.gnome.desktop.background picture-uri-dark "file://$selection"