Search Members Help

» Welcome Guest
[ Log In :: Register ]

Mini-ITX Boards Sale, Fanless BareBones Mini-ITX, Bootable 1G DSL USBs, 533MHz Fanless PC <-- SALE $200 each!
Get The Official Damn Small Linux Book. DSL Market , Great VPS hosting provided by Tektonic
Pages: (3) </ [1] 2 3 >/

[ Track this topic :: Email this topic :: Print this topic ]

reply to topic new topic new poll
Topic: Debian Menu for DSL, Script Testers Needed< Next Oldest | Next Newest >
cbagger01 Offline

Group: Members
Posts: 4264
Joined: Oct. 2003
Posted: May 23 2005,04:19 QUOTE

One of the things that I always liked about Debian and specifically Knoppix is this:

If you added a new program via apt-get, dpkg -i, or Synaptic, a new entry was added for this program in the KDE "start" menu if appropriate.  And if you removed the program via apt-get remove, the menu entry would disappear automatically.

I did a little bit of research and learned about the Debian /usr/lib/menu/ files and their syntax.  This knowledge enabled me to write a short script that will create a new submenu titled "Debian" inside the main fluxbox menu, immediately above the "Apps" submenu.

If you install or remove programs via apt-get, if you run the script again, it will dynamically rebuild the Debian menu and add or remove entries as appropriate.

It is my hope that a "Regenerate Debian Menu" item will eventually be added to DSL and this script would also be run at the end of the "Start Synaptic" script.

Anyways, here is how to use it.

1) Make a backup copy of your fluxbox menu, just in case you have a problem and need to restore your original menu:
cp /home/dsl/.fluxbox/menu /home/dsl/.fluxbox/menu.backup

2) Then use Firefox to highlight the script below and then open Beaver and paste it into a new, blank text file.  You can paste highlighted text by pushing the middle mouse button, or scrollwheel button.

3) Save the file as

4) Open an xterminal and type this to make it an executable script:
chmod 755

5) Run the script by typing:

Let me know how it works (or doesn't work) for you.  All feedback is welcome.



Code Sample
#  -   Creates a Fluxbox Debian submenu with menu items for
#                       all Debian packages that add an entry into the
#                       /usr/lib/menu directory
# Rev 0 5/21/05
# by cbagger01 from the DSL forums

# Copy the existing fluxbox menu file and strip out
# the old debmenu submenu entries and save to a temp file
cat $HOME/.fluxbox/menu | grep -v debmenu  > /tmp/oldmenu

# Find the line number directly above the (Apps) submenu
linenum=`awk '/\(Apps\)/ { print NR }' /tmp/oldmenu`
let "prevnum = linenum - 1"

# Create the first part of the new menu file
sed -n '1,'$prevnum'p' /tmp/oldmenu > /tmp/newmenu

# Create the Debian fluxbox submenu entry
echo "   [submenu] (Debian) {} # debmenu" >> /tmp/newmenu

# Collect the Debian Menu titles
# Our Debian friends do not use a consistent delimiter method for the
# title value.  If the title contains spaces, it is enclosed in quotes and
# the delimiters are START: title=" and END: "  but if the title doesn't
# contain spaces, then no quotes are used and the delimiters
# are START: title= and END: blankspace
# This sed script will parse out the title values properly regardless
# of the method used inside each menu file
cat /usr/lib/menu/* 2> /dev/null | \
sed -e 's/.*title=\([^"]*\) .*/title=\1/g' \
-e 's/.*title="\([^"]*\)".*/title=\1/g' \
-n -e 's/title=//p' > /tmp/titles

# Collect the Debian Menu commands
# The same issue exists with the command value because some command strings
# will contain spaces, for example "/bin/ls -al"
cat /usr/lib/menu/* 2> /dev/null | \
sed -e 's/.*command=\([^"]*\) .*/command=\1/g' \
-e 's/.*command="\([^"]*\)".*/command=\1/g' \
-n -e 's/command=//p' > /tmp/commands

# Loop through each title / command pair and build a menu entry
total=`awk 'END { print NR }' /tmp/titles`
while [ "$i" -le $total ];do
title=`sed -n "$i"p /tmp/titles`
command=`sed -n "$i"p /tmp/commands`
# Create the new fluxbox menu entry
echo "      [exec]  ($title) {$command} # debmenu" >> /tmp/newmenu
let "i+=1"

# Close out the Debian fluxbox submenu
echo "   [end] # debmenu" >> /tmp/newmenu

# Add the rest of the old menu to the end of our new menu
sed -n $linenum',$p' /tmp/oldmenu >> /tmp/newmenu

# This script may be running effective as root under sudo
# If so, figure out the real user name
if [ -z "$SUDO_USER" ]; then

# Change the menu file permissions if real user is not root
if [ "$realuser" != "root" ]; then
chown $realuser:staff /tmp/newmenu

# Replace the fluxbox menu file with our newly built file
mv /tmp/newmenu $HOME/.fluxbox/menu

# Clean up old temp files
rm -rf /tmp/oldmenu
rm -rf /tmp/titles
rm -rf /tmp/commands

Back to top
Profile PM 
cbagger01 Offline

Group: Members
Posts: 4264
Joined: Oct. 2003
Posted: June 01 2005,03:21 QUOTE


It's been over a week and after 98 views, no feedback.

Can someone try this thing out and see if it works for them?

I know that there are hd install users out there that would like to use apt-get/Synaptic to install applications, but prefer to use myDSL extensions because newly installed Debian packages don't appear in the DSL Fluxbox menu like the myDSL system works.

This script should solve this, while maintaining the original Fluxbox menu structure (both pre and post myDSL installs).

You don't need to be a hd user in order to give it a try.

If you are a livecd user with 128MB of RAM or more, just "Enable Apt" or choose "Synaptic" from the menu and play around a little bit.

If you don't like it, just reboot and you are back to a fresh livecd desktop.

Either way, please reply with info that it works OK or with info that it does not and exactly what appears to be wrong.


Back to top
Profile PM 
ke4nt1 Offline

Group: Members
Posts: 2329
Joined: Oct. 2003
Posted: June 01 2005,05:54 QUOTE

Had I've known before now....

I would have NOT removed all the /usr/lib/menu items
from all the extensions in the past to "trim the fat"..

These files were useless to DSL before this..


Back to top
Profile PM 
ke4nt1 Offline

Group: Members
Posts: 2329
Joined: Oct. 2003
Posted: June 01 2005,06:10 QUOTE

Seems to work for me..

I installed a few small things from debian unstable..

One was xbubble..
Another was XDigger
Another was vgagamespack
last was xblast-x11

Seems I got some bonus apps when I did..
My Debian menu reads..

High-Speed shoot 'em up game

Seems some of them don't follow the usual debian menu format..
vgagamespack didn't even have an entry..
and you see the lengthy entry for xblast-x11..

But the script works nicely, repeatedly..
Good work, cbagger01..

Back to top
Profile PM 
clivesay Offline

Group: Guests
Posts: 935
Joined: Dec. 2003
Posted: June 01 2005,12:11 QUOTE

I tested also. Not sure if I was doing everything exactly right but after installing circuslinux I had the menu items:

Circus Linux
Circus Linux!

Back to top
Profile PM MSN YIM 
14 replies since May 23 2005,04:19 < Next Oldest | Next Newest >

[ Track this topic :: Email this topic :: Print this topic ]

Pages: (3) </ [1] 2 3 >/
reply to topic new topic new poll
Quick Reply: Debian Menu for DSL

Do you wish to enable your signature for this post?
Do you wish to enable emoticons for this post?
Track this topic
View All Emoticons
View iB Code