LinuxQuestions.org
Visit Jeremy's Blog.
Home Forums Tutorials Articles Register
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - Software
User Name
Password
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.

Notices


Reply
  Search this Thread
Old 05-10-2011, 08:19 AM   #1
hilltownboy
Member
 
Registered: Jan 2008
Location: Ashfield, MA
Distribution: Debian 11 "Bullseye", Arch
Posts: 123

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

Rep: Reputation: 312Reputation: 312Reputation: 312Reputation: 312
Post the output of

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

Rep: Reputation: 198Reputation: 198
Well for starters specifying ~/wallpapers in both of these lines

Code:
WALLPAPERS="~/wallpapers"
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.

Code:
!#/bin/bash
WALLPAPERS="${HOME}/wallpapers"
cd "${WALLPAPERS}"
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
mikeb380
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
Michael
 
Old 05-11-2011, 09:23 AM   #5
hilltownboy
Member
 
Registered: Jan 2008
Location: Ashfield, MA
Distribution: Debian 11 "Bullseye", Arch
Posts: 123

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:

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
Thanks for the help, everyone
 
Old 05-11-2011, 12:31 PM   #6
ikisham
LQ Newbie
 
Registered: May 2011
Posts: 13

Rep: Reputation: 1
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: http://sblinux.org/antix-port/#Como_...fundo_de_tela_
Below is a sample conf file for the rotating background form ~/Wallpaper every 1 minute:
Code:
  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
ikisham
LQ Newbie
 
Registered: May 2011
Posts: 13

Rep: Reputation: 1
Here are some GUI tools for idesk:
http://crunchbanglinux.org/forums/to...desk-tool-gui/
http://fixxxer.mx/blog-en/?p=6
http://icecc.sourceforge.net/idesktools.html

antiX used to use tidesktool and it worked fine.
I desk page (if only for screenshots as the wiki is down): http://sourceforge.net/projects/idesk/
 
Old 09-30-2011, 09:44 AM   #8
hilltownboy
Member
 
Registered: Jan 2008
Location: Ashfield, MA
Distribution: Debian 11 "Bullseye", Arch
Posts: 123

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/autostart.sh) followed by any other commands desired on startup
 
  


Reply



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

LinuxQuestions.org > Forums > Linux Forums > Linux - Software

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

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