Download your favorite Linux distribution at LQ ISO.
Go Back > Forums > Linux Forums > Linux - Desktop
User Name
Linux - Desktop This forum is for the discussion of all Linux Software used in a desktop context.


  Search this Thread
Old 08-29-2019, 04:37 PM   #1
Earl Parker II
Registered: Jan 2002
Location: Shelby, NC, US
Distribution: Linux Mint 19.2
Posts: 130

Rep: Reputation: 17
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!
Old 08-30-2019, 06:45 PM   #2
LQ Guru
Registered: Jan 2006
Location: Virginia, USA
Distribution: Slackware, Ubuntu MATE, Mageia, and whatever VMs I happen to be playing with
Posts: 16,669
Blog Entries: 27

Rep: Reputation: 5060Reputation: 5060Reputation: 5060Reputation: 5060Reputation: 5060Reputation: 5060Reputation: 5060Reputation: 5060Reputation: 5060Reputation: 5060Reputation: 5060
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.
Old 08-30-2019, 07:16 PM   #3
LQ Guru
Registered: Sep 2013
Location: Somewhere in my head.
Distribution: Slackware (current), FreeBSD, Win10, It varies
Posts: 9,951

Rep: Reputation: 2147Reputation: 2147Reputation: 2147Reputation: 2147Reputation: 2147Reputation: 2147Reputation: 2147Reputation: 2147Reputation: 2147Reputation: 2147Reputation: 2147
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.

Last edited by BW-userx; 08-30-2019 at 07:22 PM.


Thread Tools Search this Thread
Search this Thread:

Advanced Search

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off

Similar Threads
Thread Thread Starter Forum Replies Last Post
Using feh to display a screen. Want clicking left mouse in screen to exit honest_abe Linux - General 7 05-22-2015 11:02 AM
Log rotate not rotate newFreeBSD Linux - Server 13 09-12-2013 08:59 PM
LXer: How To Let Your Wallpapers Rotate With Webilder (Linux Mint 11) LXer Syndicated Linux News 0 11-04-2011 05:11 AM
[SOLVED] Recommended random wallpaper program using feh won't work hilltownboy Linux - Software 7 09-30-2011 09:44 AM
Rotate display -- Option "Rotate" "CCW" Linux - General 0 01-27-2009 05:32 AM > Forums > Linux Forums > Linux - Desktop

All times are GMT -5. The time now is 11:52 AM.

Main Menu
Write for LQ is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
Open Source Consulting | Domain Registration