-   Linux - Desktop (
-   -   Feh: using feh to rotate wallpapers (

Earl Parker II 08-29-2019 05:37 PM

Feh: using feh to rotate wallpapers
If you are in a situation where you would like to rotate wallpapers randomly but don't have a handy application to do so, the following should work.

1. Create the following script:


export DISPLAY=:0.0
feh --bg-max --randomize /path/to/your/backdrops

Just name it what you want (I named mine, put it in your path and don't forget to make it executable.

2. Open a terminal, enter 'crontab -e' and put the following entry in your crontab:


# Backdrops
*/5 * * * * /bin/sh /path/to/your/backdrops/script

This above will rotate your wallpaper every 5 minutes, simply choose the interval you prefer.

To change/expand on the above, go to the feh manpage and scroll down to the BACKGROUND SETTING section. If there are issues with the above, or if you have a better idea, feel free to correct me. Enjoy!

frankbell 08-30-2019 07:45 PM

With Fluxbox, I use fbsetbg. Here's my script:


$ cat

while true; do
      fbsetbg -f -R ~/wallpapers
        sleep 30m

It's not original with me. It's derived from something I saw when I experimented with FVWM some years ago.

BW-userx 08-30-2019 08:16 PM

I got a gallizion images so I use a more elaborate script.

#!/usr/bin/env bash
#set -xv
#Aug 21, 2019
#to change images upon start up of desktop
#for desktop background

#load array full of colors from a file
#listing 255 ish colors.
cat "$SysColors" | shuf | shuf > tempColors
mv tempColors "$SysColors"
mapfile -t colors < "$SysColors"


find $source1 $source2 $source3 $source4 \( -type f -name "*.jpg" -o -type f -name "*.png" \) >> $HOME/boops
cat ~/boops | shuf | shuf | shuf | shuf >> $HOME/boops2
mv $HOME/boops2 $HOME/boops
mapfile -t ranArray < $HOME/boops
rm $HOME/boops

img=$(echo -e ${ranArray[ $RANDOM % ${#ranArray[@]} ]})
Esetroot -bgcolor $(echo -e ${colors[ $RANDOM % ${#colors[@]} ]}) -fit $img

while sleep 300
        img=$(echo -e ${ranArray[ $RANDOM % ${#ranArray[@]} ]})
        Esetroot -bgcolor $(echo -e ${colors[ $RANDOM % ${#colors[@]} ]}) -fit $img

works with xsetroot, fbsetbg, Esetroot,wmsetbg, and others just change the command and its args to match.

All times are GMT -5. The time now is 07:07 PM.