Jump to content

Change your Wallpaper from the Fluxbox menu


bvc
 Share

Recommended Posts

Joehill pointed this out to me...it's great!...thanks joehill!

Thank you october! (should you ever read this)

 

october, from here posted a script to let you change your wallpapers on the fly in fluxbox. Should work in others as well like bb, openbox and does work in waimea. Here's October's post at PCLinuxOnline;

Well, I got the wrinkles ironed out of the first and very simple version (most of the wrinkles were just because I am learning almost everything as I go!)

 

Here is my wallpaper changing script, version 0.01, in case anyone is interested:

 

#!/bin/sh

ls ~/wallpapers>papers

head="[exec] ("

echo "[exec] (refresh) {. papergen.sh}">papermenu

cat papers | while read line

do

tail=") {bsetbg -f ~/wallpapers/"$line"}"

echo $head$line$tail>>papermenu

done

rm papers

 

-----

 

Paste that into a new document called "papergen.sh" and save it to your home directory. Make it executable with chmod 775 papergen.sh

 

Next create a new folder to hold wallpapers in your home directory called "wallpapers". Put some pictures in it!

 

Finally add a submenu to your custom fluxbox menu that looks like this:

 

[submenu] (wallpapers) {}

[include] (~/papermenu)

[end]

 

That's it! The script should parse the contents of the directory ~/wallpapers and feed the contents into a file called "papermenu" that is included in your flux menu.

 

I'm working on more advanced versions of this script, feel free to contribute!

 

 

Because I use waimea, I don't know how much of this is applicable, but here's my contrib...well, it works :roll:

 

First, I use Esetroot from Eterm, but I use bsetbg from bb/flux for tiles because Esetroot doesn't do tiles. Etbg does do tiles but through/for Eterm. Since all wallpapers are not created equal, and because I have so many wallpapers that the menu wouldn't even fit 3 virtual screens down, I created a

papergen.sh (for Esetroot -f [fit])

papergentiles.sh (for bsetbg -t)

papergenscales.sh (for Esetroot -s [scale])

 

papergen.sh

#!/bin/sh

ls ~/wallpapers>papers

head="[exec] ("

echo "[exec] (refresh) {. papergen.sh}">papermenu

cat papers | while read line

do

tail=") {Esetroot -f ~/wallpapers/"$line"}"

echo $head$line$tail>>papermenu

done

rm papers

 

 

papergentiles.sh

#!/bin/sh

ls ~/wallpapers/tiles>tiles

head="[exec] ("

echo "[exec] (refresh) {. papergentiles.sh}">papermenutiles

cat tiles | while read line

do

tail=") {bsetbg -t ~/wallpapers/tiles/"$line"}"

echo $head$line$tail>>papermenutiles

done

rm tiles

 

 

papergenscales.sh

#!/bin/sh

ls ~/wallpapers/scales>scales

head="[exec] ("

echo "[exec] (refresh) {. papergenscales.sh}">papermenuscales

cat scales | while read line

do

tail=") {Esetroot -s ~/wallpapers/scales/"$line"}"

echo $head$line$tail>>papermenuscales

done

rm scales

 

Then I put this in my waimea menu

[submenu] (Wallpaper) {}

[submenu] (Scales) {}

  [sub] <scales>

 [include] (~/papermenuscales)

[end]

[submenu] (Wallpapers) {}

  [sub] <wallpapers>

 [include] (~/papermenu)

[end]

[submenu] (Tiles) {}

  [sub] <tiles>

 [include] (~/papermenutiles)

[end]

 

I'm sure something similar will work in flux.

Have fun :!:

Link to comment
Share on other sites

Really cool; I'll test it later. :)

 

I do a different approach, I open fluxbox with a random wallpaper; let me include this trick in the thread:

 

....



# WallPaper (random image):

wall_paper_command="/usr/bin/wmsetbg -s "

images_dir="${HOME}/xresources/backgrounds/"

image_filter="*.jpg"

images_list=($(/bin/ls ${images_dir}/${image_filter}))



image=${images_list[$((${RANDOM}%${#images_list[@]}))]}



if ! ${wall_paper_command} ${image} &> /dev/null & then

   ${Xdir}/xsetroot -solid black &

fi



....

 

That code is part of my fluxbox.S0.sh script; which is called through .fluxbox/init at the line:

session.screen0.rootCommand:    ~/.fluxbox/fluxbox.S0.rc &

 

Just a completely different approach, HTH

Link to comment
Share on other sites

Have fun :!:

 

I'm having :D

 

This will be more or less the piece of code I'm going to use for the "Change your Wallpaper from the Fluxbox menu" feature:

wall_paper_command="/usr/bin/wmsetbg -s "

images_dir="${HOME}/xresources/backgrounds/"

image_filter="*.jpg"

images_list=($(/bin/ls ${images_dir}/${image_filter}))



(

echo "[exec] (refresh) { ~/${0} }"

for image in ${images_list[@]};

do

   echo "[exec] (${image##*/}) {${wall_paper_command} ${image}}"

done

) > ~/.fluxbox/wallpaper_menu

 

Well, in fact, I'm going to rewrite both my fluxbox.S[1,0].rc scripts to include these and other new features I'm thinking of :)

 

Thanks for the tip bvc

Link to comment
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

Loading...
 Share

×
×
  • Create New...