LinuxQuestions.org

LinuxQuestions.org (/questions/)
-   Linux - Desktop (https://www.linuxquestions.org/questions/linux-desktop-74/)
-   -   Feh: using feh to rotate wallpapers (https://www.linuxquestions.org/questions/linux-desktop-74/feh-using-feh-to-rotate-wallpapers-4175660034/)

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:

Code:

#!/bin/sh
export DISPLAY=:0.0
feh --bg-max --randomize /path/to/your/backdrops

Just name it what you want (I named mine backgrounds.sh), 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:

Code:

# 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:

Code:

$ cat wallpaper.sh
#!/bin/sh

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

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.
Code:

#!/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.
SysColors=$HOME/bin/colorsOfASystem
cat "$SysColors" | shuf | shuf > tempColors
mv tempColors "$SysColors"
mapfile -t colors < "$SysColors"

source1=/home/userx/Pictures
source2=/media/data1/ScreenResizedImages
source3=/home/userx/Images
source4=/media/data1/wallhaven-papers

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
do
        img=$(echo -e ${ranArray[ $RANDOM % ${#ranArray[@]} ]})
        Esetroot -bgcolor $(echo -e ${colors[ $RANDOM % ${#colors[@]} ]}) -fit $img
done

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.