Support LQ: Use code LQ3 and save $3 on Domain Registration
Go Back > Forums > Linux Forums > Linux - Software
User Name
Linux - Software This forum is for Software issues.
Having a problem installing a new program? Want to know which application is best for the job? Post your question in this forum.


  Search this Thread
Old 05-10-2011, 08:19 AM   #1
Registered: Jan 2008
Location: Ashfield, MA
Distribution: Debian 7 "wheezy", Arch, PCLinux, Crunchbang "waldorf"
Posts: 87

Rep: Reputation: 15
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
Old 05-10-2011, 08:26 AM   #2
Senior Member
Registered: May 2010
Location: Chicago Metro
Distribution: Arch, Gentoo, Slackware
Posts: 1,690

Rep: Reputation: 308Reputation: 308Reputation: 308Reputation: 308
Post the output of

ls -al ~/wallpapers
from the root of your home directory
Old 05-10-2011, 01:01 PM   #3
Senior Member
Registered: Jun 2005
Location: England
Distribution: openSUSE, Fedora, CentOS
Posts: 1,067

Rep: Reputation: 182Reputation: 182
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.
1 members found this post helpful.
Old 05-10-2011, 11:19 PM   #4
LQ Newbie
Registered: Apr 2011
Location: SC
Distribution: ubuntu 10.10 trying 11.04 & kbuntu 10.10
Posts: 25

Rep: Reputation: 1
Cool 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
Old 05-11-2011, 09:23 AM   #5
Registered: Jan 2008
Location: Ashfield, MA
Distribution: Debian 7 "wheezy", Arch, PCLinux, Crunchbang "waldorf"
Posts: 87

Original Poster
Rep: Reputation: 15
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
Old 05-11-2011, 12:31 PM   #6
LQ Newbie
Registered: May 2011
Posts: 13

Rep: Reputation: 0
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.
Old 05-11-2011, 12:40 PM   #7
LQ Newbie
Registered: May 2011
Posts: 13

Rep: Reputation: 0
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):
Old 09-30-2011, 09:44 AM   #8
Registered: Jan 2008
Location: Ashfield, MA
Distribution: Debian 7 "wheezy", Arch, PCLinux, Crunchbang "waldorf"
Posts: 87

Original Poster
Rep: Reputation: 15
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


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
[SOLVED] preserving feh's LXDE wallpaper between sessions pargoo Slackware 7 10-06-2010 12:11 AM
LXer: Set your IP as Wallpaper with convert and feh LXer Syndicated Linux News 0 10-30-2009 04:10 AM
KDE Random wallpaper or script to create symbolic links to random files cvelasquez Linux - Software 2 02-26-2007 06:48 PM
How to wget a random file from a website, then use FEH to view it. xmrkite Linux - Software 3 10-17-2006 01:26 PM
Random Wallpaper doublejoon Linux - General 2 01-11-2006 03:35 PM

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

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
Facebook: linuxquestions Google+: linuxquestions
Open Source Consulting | Domain Registration