[SOLVED] Recommended random wallpaper program using feh won't work
Linux - SoftwareThis 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.
Notices
Welcome to LinuxQuestions.org, a friendly and active Linux Community.
You are currently viewing LQ as a guest. By joining our community you will have the ability to post topics, receive our newsletter, use the advanced search, subscribe to threads and access many other special features. Registration is quick, simple and absolutely free. Join our community today!
Note that registered members see fewer ads, and ContentLink is completely disabled once you log in.
If you have any problems with the registration process or your account login, please contact us. If you need to reset your password, click here.
Having a problem logging in? Please visit this page to clear all LQ-related cookies.
Get a virtual cloud desktop with the Linux distro that you want in less than five minutes with Shells! With over 10 pre-installed distros to choose from, the worry-free installation life is here! Whether you are a digital nomad or just looking for flexibility, Shells can put your Linux machine on the device that you want to use.
Exclusive for LQ members, get up to 45% off per month. Click here for more info.
Recommended random wallpaper program using feh won't work
The following program from wiki.Debian.org/openbox is shown under "Setting your background image with feh" (random wallpaper), but for me it comes up with error messages.
Code:
#wallpaper.sh
WALLPAPERS="~/wallpapers"
ALIST=( 'ls -wl ~/wallpapers' )
RANGE=${#ALIST[@]}
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?
Code:
feh --bg-scale $WALLPAPERS/${ALIST[$number]}
./wallpaper.sh: line 7: let: LASTNUM='cat ~/wallpapers/.last' + number: syntax error: operand expected (error token is "'cat ~/wallpapers/.last' + number")
./wallpaper.sh: line 8: let: number= % 1: syntax error: operand expected (error token is "% 1")
./wallpaper.sh: 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
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
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:
Code:
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
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: http://sblinux.org/antix-port/#Como_...fundo_de_tela_
Below is a sample conf file for the rotating background form ~/Wallpaper every 1 minute:
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.
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/autostart.sh) followed by any other commands desired on startup
LinuxQuestions.org is looking for people interested in writing
Editorials, Articles, Reviews, and more. If you'd like to contribute
content, let us know.