I have about 57 rather nice wallpapers in my ~/wallpapers directory, most of which I hardly ever see, so I've written a script that will randomly choose and display one every thirty minutes. For once it isn't called from a cron job, but from an alias, and quite happily sits in the background just waiting for it to fire off again. The alias that I use for it is -
alias wall='nohup wallpaper &'
I use 'nohup' so that it is just working in the background and frees up your terminal for other things.
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 | #!/bin/bash
set -e
#: Title : wallpaper
#: Date : February 2014
#: Author : Sharon Kimble
#: Version : 1.0
#: Description : changes your wallpaper, and can be run from an alias, I use *alias wall='nohup wallpaper &'*
#: Options : length of time before the wallpaper changes again
#; Requirements : feh
#: License : GNU GPL 3.0 or later
####################################################
# Options
change=30
###################################################
while true; do
find $HOME/wallpapers -type f \\( -name '\*.jpg' -o -name '\*.png' \\) -print0 \|
shuf -n1 -z \| xargs -0 feh --bg-fill
sleep "$change"m
done
|
UPDATE
For those folks who use either "fluxbox" or "openbox" you can put this bit of code in your user-menu -
[exec] (Change your wallpaper) {~/bin/wallpaper}
[exec] (Kill wallpaper) {pkill wallpaper}
Comments
comments powered by Disqus