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