LinuxQuestions.org
Help answer threads with 0 replies.
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 02-19-2005, 07:47 AM   #1
Colonel-1990
Member
 
Registered: Feb 2005
Posts: 71

Rep: Reputation: 15
Saving A Set Wallpaper.....


Hi,

Os: Slackware 10
Window Manager: Fluxbox

Problem:

Been trying to work out for the past two days how to set backgrounds in fluxbox. Then i realised it was so simple lol. I have managed to set a background that i want but the problem occurs when i logout of X or reboot. I startx, enter fluxbox and the background is reset to the standard gray that comes with the theme i am running (Cthulhain). Anyone have any idea how i can make it store the background i have set?...


Thanks,
Colonel-1990.
 
Old 02-19-2005, 05:27 PM   #2
Artanicus
Member
 
Registered: Jan 2005
Location: Finland
Distribution: Ubuntu, Debian, Gentoo, Slackware
Posts: 827

Rep: Reputation: 31
I myself got bored of that, so I made this script to get around better.. Hope you can catch some ideas from it.. (;

Code:
#!/bin/bash
# the point of this is to periodicly change the wallpaper symlink destination and run the new bg visible.

# we wont do a thing unless fluxbox is actually running
tsek=`ps aux | grep fl[u]xbox | cut -d " " -f 1 | tail -n 1`
if [ -z $tsek ]; then
exit 0
fi

# lets set some variables
juuseri=fyranthalas
DISPLAY=:0
symlink=/share/images/wallpapers/fluxbox.img # every theme has this set as the bg
dir=/share/images/wallpapers/fb.random/
#bgsetter=/usr/bin/wmsetbg # not working with crons
bgsetter="/usr/X11R6/bin/fbsetbg -f" # doesnt work with crons either ):

# go to the right user to accomplish the bg set
if [ "$USER" != "$juuseri" ]; then
su $juuseri
fi


# random code stolen from fbsetbg, thanks.. (;
        number_of_wallpapers=`ls $dir|wc -l`
        # some shells don't support $RANDOM
         if [ -z $RANDOM ]; then
           randomnumber=`(echo $$ ;time ps; w ; date )2>&1 | cksum | cut -f1 -d' '`
        else
            randomnumber=$RANDOM
        fi
        wallpapernumber=`expr $randomnumber % $number_of_wallpapers + 1`
        wallpaper="$dir/`ls $dir|sed -n ${wallpapernumber}p`"
# stolen code ends

# and now we attempt to make the symlink
rm /share/images/wallpapers/fluxbox.img
ln -s $wallpaper /share/images/wallpapers/fluxbox.img

# and finaly, we set the bg
$bgsetter /share/images/wallpapers/fluxbox.img
Made this for the fun of it, but you get an idea hopefully how this can be used.. (:
 
Old 02-19-2005, 06:19 PM   #3
Colonel-1990
Member
 
Registered: Feb 2005
Posts: 71

Original Poster
Rep: Reputation: 15
Dont quite understand where to put this script/what it does. Are you saying there is no way of saving the desktop image?. Seems a bit stupid doesnt it ?

Colonel-1990.
 
Old 02-19-2005, 06:32 PM   #4
Artanicus
Member
 
Registered: Jan 2005
Location: Finland
Distribution: Ubuntu, Debian, Gentoo, Slackware
Posts: 827

Rep: Reputation: 31
it is.. The main problem is, that in a way, fluxbox doesnt have a wallpaper system. fbsetbg and similar programs just "draw" it into the root window.. So, obviously when the root window closes, the render placed upon it also goes away.. One of the easiest ways is to do this:

1. cd to your wallpapers directory (the place you keep your wallpapers) and issue:
Code:
rm fluxbox.img && ln -s wallpaper_you_want.jpg fluxbox.img
2. Save the following code into a file, name it for eg. prepare.sh
Code:
#!/bin/bash
file=$1
grep -iv rootCommand $file > $file.clean
worked=`grep rootCommand $file.clean`
echo -n $file has been altered
if [ -z $worked ]; then
echo "rootCommand:    bsetbg -f /path/to/fluxbox.img" >> $file.clean
echo " succesfully"
else echo " unsuccesfully"
fi
grep rootCommand $file.clean
then issue:
Code:
chmod a+x prepare.sh
Now, we can use this upon your themes, effectively replacing the line that sets the bg with the line pointing to the symlink. Heres how:
Code:
./prepare.sh ~/.fluxbox/styles/The_style_you_wana_use
3. Thats that, now you oughta get the wallpaper you have symlinked every time you start, and if you want to change the image, just redo #1 (:

Last edited by Artanicus; 02-19-2005 at 06:34 PM.
 
Old 02-19-2005, 07:25 PM   #5
Colonel-1990
Member
 
Registered: Feb 2005
Posts: 71

Original Poster
Rep: Reputation: 15
i cant seem to locate fluxbox.img :S does this file vary from person to person?

Colonel-1990.
 
Old 02-20-2005, 02:18 AM   #6
Artanicus
Member
 
Registered: Jan 2005
Location: Finland
Distribution: Ubuntu, Debian, Gentoo, Slackware
Posts: 827

Rep: Reputation: 31
it shouldnt exist, we create it here.. The rm stage is just to make sure theres nothing in the way..
 
Old 02-21-2005, 12:05 PM   #7
Colonel-1990
Member
 
Registered: Feb 2005
Posts: 71

Original Poster
Rep: Reputation: 15
Found this out ages ago, but didnt post owt. If people are finding it hard to save a set wallpaper, its simple. What i did is i went into the theme directory e.g. /usr/X11R6/share/fluxbox/styles/theme and down towards the bottom on some themes there is a part that says ' rootCommand: fbsetbg -f ~/.fluxbox/wallpaper.png ' **please note ** you can change the ' fbsetbg ' part to whatever you use. change the part that says ' ~/.fluxbox/wallpaper.png ' to where your background is saved, nd if you change your theme you will have to repeat this. Simple as that... hope this helps people with the same problem ....

Colonel-1990.
 
Old 02-21-2005, 12:12 PM   #8
Artanicus
Member
 
Registered: Jan 2005
Location: Finland
Distribution: Ubuntu, Debian, Gentoo, Slackware
Posts: 827

Rep: Reputation: 31
yeah, thats a simplification of what my examples do.. Editing several themes by hand just gets annoying after a while without automation.. (:
 
Old 02-21-2005, 05:27 PM   #9
jrdioko
Member
 
Registered: Oct 2002
Distribution: Debian 6.0.2 (squeeze)
Posts: 944

Rep: Reputation: 30
I found in some Fluxbox FAQ that you can set a default background for all themes by editing/adding the following line to .fluxbox/init:

Code:
session.screen0.rootCommand:    bsetbg ~/files/images/image.jpg
 
Old 02-21-2005, 06:15 PM   #10
Colonel-1990
Member
 
Registered: Feb 2005
Posts: 71

Original Poster
Rep: Reputation: 15
Yeah you can do that, but the problem is... is doesnt store the background, when you exit X or reboot it puts the standard background of the theme back on... so there is a few ways to get around this, the simple way i found which i explained firther up, and Artanicus's slightly more complex way, and i would think there are even more, just depends what people find easiest really.

Hope this helps some people ,
Colonel-1990.
 
Old 02-21-2005, 06:24 PM   #11
jrdioko
Member
 
Registered: Oct 2002
Distribution: Debian 6.0.2 (squeeze)
Posts: 944

Rep: Reputation: 30
That's interesting, that doesn't happen to me on either the old (0.1) or new (0.9) version of Fluxbox. I've always set the default background there and ignored whatever was in the theme definition, and it always stays through reboots, etc.
 
Old 03-06-2005, 07:31 PM   #12
jp-lack
Member
 
Registered: Mar 2005
Location: NJ - US
Distribution: Slackware
Posts: 93

Rep: Reputation: 15
i changed the line rootComand: in usr/X11R6/share/fluxbox/styles/Nyz to fbsetbg -f ~/mypicture.jpg and works fine..... everytime i open startx i get the wallpaper...
 
Old 03-07-2005, 07:07 AM   #13
Colonel-1990
Member
 
Registered: Feb 2005
Posts: 71

Original Poster
Rep: Reputation: 15
Yep thats what i do jp-lack, think i explained firther up. Works fine for me, just got a few problems with my linux atm that i cba sorting yet .

Colonel-1990.
 
Old 03-07-2005, 09:27 AM   #14
95se
Member
 
Registered: Apr 2002
Location: Windsor, ON, CA
Distribution: Ubuntu
Posts: 740

Rep: Reputation: 32
Go into your ~/.fluxbox folder. Now create (with a text editor) a file called startup , and in this just add the line to set your wallpaper, (fbsetbg -l for me). Then to start fluxbox instead of using fluxbox use startfluxbox (i.e. in .xinitrc use startfluxbox to start fluxbox), this just runs the ~/.fluxbox/startup script. fbsetbg -l will set the last wallpaper you set with fbsetbg. You have to start fluxbox at the end of the script though.

An example of my ~/.fluxbox/startup
Code:
#turn off annoying beep
xset -b

#set last wallpaper and start idesk
fbsetbg -l && idesk &

#set volume to audible level ;)
aumix -v85 -w70 &

#start fluxbox
exec /usr/bin/fluxbox

Last edited by 95se; 03-07-2005 at 09:30 AM.
 
Old 03-07-2005, 11:03 AM   #15
Colonel-1990
Member
 
Registered: Feb 2005
Posts: 71

Original Poster
Rep: Reputation: 15
Why not just do what we said before, and then you dont have to go through complicated things like that?, suppose theres many ways to do it though.

Colonel-1990.
 
  


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 06:19 AM
Doub about `net time set` and daylight saving time Thakowbbery Linux - Software 0 10-17-2005 05:23 AM
Wallpaper: SLide show wallpaper from online pictures eponymous Linux - Software 0 11-29-2004 01:28 PM
Can't set a wallpaper in Fluxbox 0.98 AMMullan Linux - Software 5 02-24-2004 09:01 PM
saving and not saving sessions on desktop ergo_sum Linux - Newbie 2 09-26-2003 07:27 AM


All times are GMT -5. The time now is 08:37 PM.

Main Menu
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
identi.ca: @linuxquestions
Facebook: linuxquestions Google+: linuxquestions
Open Source Consulting | Domain Registration