#!/bin/bash # This script will generate a directory and symlink structure which # can be used with the wm-gen-desktop-menu script to create a wmaker # menu on the fly for installed progams with a *.desktop file # In order to keep this database up-to-date, this script should be run # after installing new software, or it can be included in your startup if [ $1 ] ; then DESKTOP_FILES_PATH=$1 else DESKTOP_FILES_PATH=~/GNUstep/DesktopMenus fi # if you already have xdg menus, then you probably have desktop files here: if [ -d ~/.local/share/applications ] ; then DESKTOP_APPS=~/.local/share/applications else # otherwise, use the ones installed in the system directory DESKTOP_APPS=/usr/share/applications fi for DSK in $(ls -1 $DESKTOP_APPS/*.desktop) ; do CATEGORIES=$(grep Categories $DSK |cut -f2 -d'=') OLDIFS=$IFS IFS=';' for CATEGORY in $CATEGORIES ; do if ! [ -d $DESKTOP_FILES_PATH/$CATEGORY ] ; then mkdir -p $DESKTOP_FILES_PATH/$CATEGORY fi if ! [ -e $DESKTOP_FILES_PATH/$CATEGORY/$(basename $DSK) ] ; then # if you want to save space you can create links to the desktop files #ln -sf $DSK $DESKTOP_FILES_PATH/$CATEGORY/$(basename $DSK) # It's probably better to copy the files so they can be altered by the user cp $DSK $DESKTOP_FILES_PATH/$CATEGORY/$(basename $DSK) fi done IFS=$OLDIFS done