This is going to be a bit of a shorter article than I normally write. Basically, I’m showing off a random wallpaper switcher. I’ve tried several tools that purport to do the job. None of which were particularly flexible and seemed to be more trouble than they’re worth. Prior to this, I had actually used tools like hsetroot and feh to either set the background to a pixmap or just a solid color. Neither of these were really a decent solution sets in my mind.
set -l WALLPAPERS $HOME/Pictures/Wallpaper set -l BGOPTIONS fill set -l URGENCY low set -l EXPIRE 5000 set -l TITLE "Wallpaper Change" set -l MESSAGE "Hey, your wallpaper changed!" set -l ICONPATH /usr/share/feh/images/feh.png feh --randomize --no-fehbg --bg-$BGOPTIONS $WALLPAPERS notify-send --icon=$ICONPATH --app-name=feh --urgency=$URGENCY --expire-time=$EXPIRE $TITLE $MESSAGE
This script requires feh, though you could swap in any sort of tool that can set the root pixmap. If you choose to change it, you’ll need to come up with your own randomization. I set the –no-fehbg option because I don’t need it generating a script in my $HOME. Once set, I have notify send tell me about it. This is more for debugging purposes so that I know when it kicks off.
[Unit] Description=Wallpaper changer [Service] Type=simple ExecStart=/home/ndegruchy/.local/bin/wallpaper [Install] WantedBy=timers.target
A pretty much bog-standard systemd service file. I place this into $HOME/.config/systemd/user. Make sure you update the ExecStart with the location of the script above.
[Unit] Description=Changes wallpaper hourly [Timer] OnBootSec=10min OnUnitActiveSec=1h [Install] WantedBy=timers.target
Another pretty bog-standard systemd unit file, this one is a timer. Like above, go ahead and drop it in $HOME/.config/systemd/user. Use the same name as the service file, otherwise it wont work. You can change the time interval, too.
Put it All Together
Now that you’ve got all the files in place, you can enable it with:
systemctl --user enable wallpaper.timer systemctl --user start wallpaper.timer
This will begin the countdown. If you want to see the status of the timer, you can check on it with:
systemctl --user list-timers wallpaper.timer # OR systemctl --user list-timers --all
This will give you some information about the timer in a fairly understandable table. Hope this helps someone!