Less switchy wallpaper switcher?

Hello,
You can also launch different bash with timers.
The simple bash

#!/usr/bin/env bash

WALLPAPER_DIR="/home/work/Pictures/Wallpaper"
RANDOM_PICTURE=$(ls $WALLPAPER_DIR -1 | shuf -n 1)

gsettings set org.gnome.desktop.background picture-options "zoom"
gsettings set org.gnome.desktop.background picture-uri "file://$WALLPAPER_DIR/$RANDOM_PICTURE"

if you want to use crontab and not timers you need to add this line at the beginning of the script

PID=$(pgrep gnome-session)
export DBUS_SESSION_BUS_ADDRESS=$(grep -z DBUS_SESSION_BUS_ADDRESS /proc/$PID/environ|cut -d= -f2-)

here is a good explain for timers
https://documentation.suse.com/smart/systems-management/html/systemd-working-with-timers/index.html

2 Likes