I was playing around with fvwm-menu-desktop and realised that it doesn't
support gnome2. So I wrote a hasty script with awk to do something about
it. Here it is ... I put it into my latest mondo configuration scripts at
http://bhepple.freeshell.org/fvwm2
(these scripts auto-gen a whole bunch of menus and buttons based on what
is installed on the machine - no more dead links in my fvwm!)
Pop this into your .fvwmrc and adjust the path to the script:
AddToMenu RootMenu "Gnome-2 Menu%mini/x.xpm%" Popup Gnome2Menu
PipeRead ~/.fvwm/fvwm-gnome2
By the way - I found that to get the old gnome-1 menus come up correctly I
needed to set "--lang C" on the fvwm-menu-desktop command line.
PipeRead 'fvwm-menu-desktop --enable-mini-icons --lang C'
PipeRead 'fvwm-menu-desktop --desktop gnome-user --enable-mini-icons --lang C'
PipeRead 'fvwm-menu-desktop --desktop gnome-redhat --enable-mini-icons --lang C'
Here's the gnome-2 script:
#! /bin/sh
# Very hasty and simple script to generate some menus for fvwm from the gnome directory /usr/share/applications
# Needs bells, whistles, options, flannel, improvements, documentation, kde. Nah.
cd /usr/share/applications
for FILE in *.desktop; do
NAME=`basename $FILE .desktop` awk -F= '
/^Name=/ { name=$2 }
/^Name/ { if (!altname) { altname=$2 } }
/^Categories=/ { categories=$2 }
/^Icon=/ { icon=$2 }
/^Exec=/ { run=$2 }
END {
filename = ENVIRON["NAME"]
if (!name) { name = altname}
if (!name) { name = filename}
if (!run) { run = filename }
if (!icon) { icon = "gnome-unknown.png" }
printf("%s:%s:%s:%s:%s\n", categories, name, filename, icon, run)
}' $FILE
done | sed -e "s/^GNOME;//"|sed -e "s/^Application;//"| sort | awk -F: '
BEGIN {
menu=""
print "DestroyMenu Gnome2Menu"
print "AddToMenu Gnome2Menu \"Gnome-2 Menu%%gnome-unknown.png%%\" Title"
}
function build_menu(cat,name,filename,icon,run) {
num=split(cat,list,";")
menu_name=""
parent_menu="Gnome2Menu"
for (i=1; i<num; i++) {
if (menu_name) {
menu_name=menu_name "-" list[i]
} else {
menu_name = list[i]
}
if (!exists[menu_name]) {
exists[menu_name]="y"
printf("AddToMenu %s \"%s%%gnome-unknown.png%%\" Popup %s\n", parent_menu, list[i], menu_name)
printf("DestroyMenu %s\n", menu_name)
printf("AddToMenu %s \"%s\" Title\n", menu_name, menu_name)
}
parent_menu = menu_name
}
printf("AddToMenu %s \"%s (%s)%%%s%%\" Exec exec %s\n", menu_name, name, filename, icon, run)
}
{
categories=$1
name=$2
filename=$3
icon=$4
run=$5
build_menu(categories,name,filename,icon,run)
}'
--
Bob Hepple
mailto:bhepple_at_freeshell.org http://bhepple.freeshell.org
Public Key: http://bhepple.freeshell.org/public_keys.txt
--
Visit the official FVWM web page at <URL: http://www.fvwm.org/>.
To unsubscribe from the list, send "unsubscribe fvwm" in the body of a
message to majordomo_at_fvwm.org.
To report problems, send mail to fvwm-owner_at_fvwm.org.
- application/pgp-signature attachment: stored
Received on Mon Jul 12 2004 - 08:18:53 BST