-   Linux - Software (
-   -   Recommended random wallpaper program using feh won't work (

hilltownboy 05-10-2011 09:19 AM

Recommended random wallpaper program using feh won't work
The following program from is shown under "Setting your background image with feh" (random wallpaper), but for me it comes up with error messages.

ALIST=( 'ls -wl ~/wallpapers' )
let "number=$RANDOM"
let LASTNUM="'cat $WALLPAPERS/.last' + number"
let "number=$LASTNUM % $RANGE"
echo $number > $WALLPAPERS/.last

feh --bg-scale $WALLPAPERS/${ALIST[$number]}

Here are the error messages, which seem to say that /.last is not valid.
Is that right? If so, how to fix?


feh --bg-scale $WALLPAPERS/${ALIST[$number]}
./ line 7: let: LASTNUM='cat ~/wallpapers/.last' + number: syntax error: operand expected (error token is "'cat ~/wallpapers/.last' + number")
./ line 8: let: number= % 1: syntax error: operand expected (error token is "% 1")
./ line 9: ~/wallpapers/.last: No such file or directory
feh WARNING: ~/wallpapers/ - File does not exist
feh ERROR: Couldn't load image in order to set bg

andrewthomas 05-10-2011 09:26 AM

Post the output of


ls -al ~/wallpapers
from the root of your home directory

arizonagroovejet 05-10-2011 02:01 PM

Well for starters specifying ~/wallpapers in both of these lines


ALIST=( 'ls -wl ~/wallpapers' )

is daft. The second line should use the WALLPAPERS variable.

The script as you post it won't work because you're using ' where you should be using `

Also the script is way more complicated than it needs to be. Try this.


feh --bg-scale "$(ls | sort -R | head -1)"

You could reduce that by a line by not using the WALLPAPERS variable.

mikeb380 05-11-2011 12:19 AM

random wallpaper
I don't have a clue on what you asked, but I have been using a gui program called "Desktop Nova" along with "Desktop Nova-Tray. You can set up to get Wallpaper from various files and can tell it to randomize it. Can also set up the period between each graphic. I am using photos in two groups and it works wonderfully. Hope this helps you
Michael :Pengy:

hilltownboy 05-11-2011 10:23 AM

The short program offered by Arizonagroovejet (reduced to two lines as suggested) works perfectly for me, so I'll stay with that. You caught me in a syntax error with the longer program from the wiki ( ' that should be ` ), but I still did not get it to work.
To reply to andrewthomas:


total 1016
drwxr-xr-x  2 root  root    4096 Apr 23 12:53 .
drwxr-xr-x 37 norman norman  4096 May 11 10:20 ..
-rw-r--r--  1 norman norman 434723 Apr 23 12:42 BlueGoosecoloradg.jpg
-rw-r--r--  1 norman norman 114604 Apr 23 12:45 blue goose pigeon island.JPG
-rw-r--r--  1 norman norman 113483 Apr 23 12:46 blue goose running.JPG
-rw-r--r--  1 norman norman  71036 Apr 23 12:49 dsc00345.jpg
-rw-r--r--  1 norman norman  34085 Apr 23 12:48 GeorgeTrey.jpg
-rw-r--r--  1 norman norman 111280 Apr 23 12:48 nsw V & aunt nancy.JPG
-rw-r--r--  1 norman norman 111412 Apr 23 12:53 pool1.JPG

Thanks for the help, everyone

ikisham 05-11-2011 01:31 PM

iDesk is great for that and very lightweight.

Unfortunately it seems its wiki is down (maybe forever?).
But a while ago I wrote some instructions to set it in antiX's faq in Brazilian Portuguese. Maybe you could translate it with google:
Below is a sample conf file for the rotating background form ~/Wallpaper every 1 minute:

  Background.File: image.jpg
  Background.Delay: 1
  Background.Source: ~/Wallpaper
  Background.Mode: Scaled
  Background.Color: #C2CCFF

To have a fixed image, leave 'Background.Source:' empty and put the image path in 'Background.File:'.
antiX, it seems, doesn't come anymore with idesk and its GUI config tool but I'll try and find out wich one it used.

ikisham 05-11-2011 01:40 PM

Here are some GUI tools for idesk:

antiX used to use tidesktool and it worked fine.
I desk page (if only for screenshots as the wiki is down):

hilltownboy 09-30-2011 10:44 AM

To recap, i.e. How to program Random Wallpapers with feh:
With wallpaper images filed in a file called wallpapers in one's home directory, use the following two commands:

cd ~/wallpapers
feh --bg-scale "$(ls / sort -R / head -1)" &

I have these in my autostart file (~/.config/openbox/ followed by any other commands desired on startup

All times are GMT -5. The time now is 09:54 AM.