Hi all,

I build the Mutagenix LiveCD Suite(http://mutagenix.org) which provides fvwm as an alternate to GNOME for the desktop CD. I wanted to be able to provide an fvwm menu which would give access to all the GNOME programs already installed on the CD.

I came up with a small script which gets 90% there. It does provide a menu system of all the gnome apps, but is not well organized. I'm providing the script here in the hopes that someone else will be interested enough to help out.

I'm not a programmer by trade, so please go easy on the flaming for any mis-steps. :) Also, I'm cutting and pasting, so doublecheck for any extra new-lines that get thrown in there.

To use: execute and pipe output to a temp file. Insert temp file into .fvwm2rc or your themed fvwm however appropriate. I use a single .fvwm2r, so just opened it up, removed the old "Special" menu portion and replaced it with the output from this program.

thanks,

Dan

### begin script

#!/bin/sh

for file in /etc/xdg/menus/applications.menu
  do
    if [ -n "`echo $file | grep applications`" ];then Menu="Special"; fi
    grep Category $file | grep -v Not | sed -e "s/^ //g" \
        | awk '{print $1}' | sed "s/</>/g" | awk -F">" '{print $3}' \
        | sort | uniq > /tmp/gnomemenu_categories

for line in `cat /tmp/gnomemenu_categories`
  do
    ### Create Secondary Menus
      echo "DestroyMenu \"$line\" "
      echo "AddToMenu \"$line\" "
      for i in /usr/share/applications/*
        do
category=`grep "^Categories" $i | cut -f2 -d= | awk -F";" '{print $2, $3}' | grep $line`
            if [ -n "$category" ];then
              name=`grep "^Name=" $i | cut -f2 -d=`
              exec=`grep "^Exec" $i | cut -f2 -d=`
              icon=`grep "^Icon" $i | cut -f2 -d=`
              #echo "$category || $name ||  $exec || $icon" | sort |uniq
              echo "+ \"$name\" exec $exec "

            fi
        done
  done

### Create Top Level menus
    echo "DestroyMenu \"$Menu\" "
    echo "AddToMenu \"$Menu\" "
    for line in `cat /tmp/gnomemenu_categories`
        do
          echo "+ \"$line\" Popup \"$line\"  "
        done
done

#### End script

Reply via email to