LinuxQuestions.org
Welcome to the most active Linux Forum on the web.
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - Newbie
User Name
Password
Linux - Newbie This Linux forum is for members that are new to Linux.
Just starting out and have a question? If it is not in the man pages or the how-to's this is the place!

Notices


Reply
  Search this Thread
Old 12-28-2007, 07:16 PM   #1
paperplane
Member
 
Registered: Dec 2007
Location: england
Distribution: slackware 11
Posts: 35

Rep: Reputation: 15
new wallpaper on startup


hello,

there is a particular comic strip i like, and ive got a folder full of strips in .gif format. i want to be able to set a new strip as wallpaper each time i start my machine, and im looking to use a script and keep everything as simple as possible. im using slackware+fluxbox.

the wallpapers need to be set in the correct order (2007.001.gif, then 2007.002.gif, 2007.003.gif etc) to follow the natural progression of the comic strip.

im thinking i need to list the folder of .gif's and send that info to a text file, then write a script that:

A. reads the first line of the text file and sends that information to FBsetbg (fluxbox's wallpaper setter).

B. then comments out that line, so that the next time the file is read on startup, it skips down to the next gif.

ive got the feeling this may be slightly more complicated than it first appears. im guessing i need to use something like sed? or is there a simpler way of achieving the same result? i have limited experience with shell scripts, but i know about a few things, such as piping and variables (kind of

Last edited by paperplane; 12-28-2007 at 07:20 PM.
 
Old 12-28-2007, 09:04 PM   #2
fuzzyworm
Member
 
Registered: Sep 2003
Location: Stroud, UK
Distribution: Kubuntu, Debian
Posts: 149

Rep: Reputation: 15
This should do it:

Code:
#!/bin/bash

#
#Get previous background
#
touch .lastbg
read LASTBG < <(cat .lastbg)

#
#Get next in folder
#
acom="/${LASTBG}/{getline; print}"
read NEWBG < <( ls *.gif | awk "$acom" /dev/stdin)

#
#Update file
#
echo $NEWBG > .lastbg

#
#In next line, replace 'echo' with appropriate syntax for FBSetBG, or whatever
#
echo $NEWBG
It's not especially pretty, but it should do the job, working through a folder of .gif files, and in this case, echoing their filename.

Edit:
This script assumes it will be running in the same folder as the files, you may need to tweak it a bit to help it deal with not being.

Edit:
You may also like to tweak the way that it handles the very first file in the list. I'm afraid I'm off to bed now and don't have any more time to look at it, but at the moment it ignores the first file. Anyone feel free to post any suggestions, and I will amend accordingly.

Hope this is of some help

Last edited by fuzzyworm; 12-28-2007 at 09:12 PM. Reason: 1st edit for "file not found" error, 2nd for first bg bug
 
Old 12-29-2007, 09:17 AM   #3
paperplane
Member
 
Registered: Dec 2007
Location: england
Distribution: slackware 11
Posts: 35

Original Poster
Rep: Reputation: 15
cant get it to work, when i execute the script from within a terminal it just hangs there and wont give me the console back. however, its given me food for thought

thanks fuzzy.

Last edited by paperplane; 12-29-2007 at 09:29 AM.
 
Old 12-30-2007, 03:00 PM   #4
fuzzyworm
Member
 
Registered: Sep 2003
Location: Stroud, UK
Distribution: Kubuntu, Debian
Posts: 149

Rep: Reputation: 15
That's odd, I thought maybe I'd made a typo, but I downloaded from my post and ran it, and it worked ok.

Hmmm...

Let me know if you find out why it's not working
 
  


Reply


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
How to set wallpaper in fluxbox at startup? donJulio Linux - Software 8 08-20-2009 07:19 AM
Refreshing Desktop Wallpaper - Address of Wallpaper beanus Linux - Desktop 4 07-16-2007 02:57 PM
one random wallpaper on startup? newbiesforever Linux - General 4 05-30-2007 01:11 PM
Fluxbox wallpaper list which wallpaper ? davimint Linux - Desktop 2 03-04-2007 01:39 AM
Wallpaper: SLide show wallpaper from online pictures eponymous Linux - Software 0 11-29-2004 02:28 PM


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

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