> Sean 'Shaleh' Perry wrote: > > > > > > > > Thanks for the explanations on your script. I keep all by > > > backgrounds in > > > ~/.blackbox/backgrounds and like all the styles in the styles > > > directory > > > are automatically read and show up as a submenu, it would be nice to > > > have something which does that for the backgrounds directory... > > > > > > Probably do it easiest with a simple bash script, no? > > > > > > > or another fluffy feature patch to add a Backgrounds menu like Styles. > > It > > reads all of the image files names, then calls bsetbg whenever you > > choose one. > > Anyone done anything like this already? > > Thanks. > > Jonathan > There seems to be renewed interest in this sort of thing, so I'll resend this from 4 months ago.... ----- Forwarded message from Jason Kasper <[EMAIL PROTECTED]> ----- From: Jason Kasper (vanRijn) <[EMAIL PROTECTED]> Cc: [EMAIL PROTECTED] Subject: Re: Generating a menu with a sh script Date: Wed, 1 Nov 2000 08:17:29 -0500 Message-Id: <00110108172901.00965@judea> Sender: [EMAIL PROTECTED] Hey guys, actually, I use this exact same concept in blackbox to not only generate a menu based on whatever files are in my ~/.blackbox/backgrounds directory, but to also regenerate it every time a background is chosen--and ***and this is essential to me*** to recreate the backgrounds "menu" for blackbox and indicate which background I last used by putting a "*" before and after the name of the background that I last selected. Anyhoo, I'll cut and paste it below.... ------------------------%< snip here %<------------------------ #!/bin/sh # if we're passed in an argument, then we need to set the background # image and rewrite our background menu file with an *asterisk* indicating # whichever image we last set.... otherwise, we just generate our # backgrounds.menu file create_menu() { echo "[submenu] (backgrounds)" > ../backgrounds.menu ls | while read file do if [ $1 = $file ] then echo "[exec] (* $file *) { ~/.blackbox/background_menu.sh $file}" \ >> ../backgrounds.menu else echo "[exec] ($file) {~/.blackbox/background_menu.sh $file}" \ >> ../backgrounds.menu fi done echo "[end]" >> ../backgrounds.menu } alias ls=ls cd ~/.blackbox/backgrounds/ if [ $1"X" = "X" ] then create_menu "NO" else bsetbg $1 create_menu $1 fi ------------------------%< snip here %<------------------------ This is the relevant section of my ~/.blackboxmenu file: [include] (~/.blackbox/backgrounds.menu) As far as setting it up... 1) save this script as ~/.blackbox/background_menu.sh, chmod it to 755 or something otherwise executable 2) run it once to generate the menu file ~/.blackbox/backgrounds.menu (cd ~/.blackbox/ ; ./background_menu.sh) That's it! Note, please, that this script used the "bsetbg" utility which I believe is included in the newer blackbox distributions.... Every time the script that I pasted above runs (and it is called to both set the background and generate the menu file), it refreshes the menu file and indicates which background you last picked. It works flawlessly for me and I'm rather proud of it. =:) Have fun kiddies!!! Your friendly neighborhood vanRijn.... On Tuesday 31 October 2000 19:30, Sean 'Shaleh' Perry sauntered into my coffee shop and said: > On 01-Nov-2000 antipop wrote: > > I've been trying to learn shell scripting and had an interesting idea. I > > have a directory full of backgrounds, and I add each background to my > > menu so I can switch between them easily. This is a pain in the ass. > > > > I was wondering: is it possible to get blackbox to use a shell script as > > a menu? I tried using a simple one that just cat'ed my menu but that > > didn't work. Anyone have any ideas I could try to get bb to use a sh > > script (or rather, the results of a script)? > > wheneever you add a new image, run update-bgs or some such which writes out > a menu file and have bb include it. Kinda like how the old style menu > worked. -- ���`����,��,����`����,��,����`��� Jason Kasper (vanRijn) Systems Engineer bash$ :(){ :|:&};: VORFA ----- End forwarded message ----- -- ���`����,��,����`����,��,����`��� Jason Kasper (vanRijn) Systems Engineer bash$ :(){ :|:&};: VORFA
