#! /bin/sh # See http://standards.freedesktop.org/menu-spec/latest/ # Main Categories: cats="AudioVideo Development Education Game Graphics Network Office Settings System Utility" # The following line must be added manually to the designated ROOTMENU # "Applications" MENU fdoapps echo "MENU fdoapps {" for cat in ${cats} do echo -e '\t'${cat} MENU ${cat} done echo "}" # FIXME: fallback for (faulty) menus which specify none of the Main Categories for cat in ${cats} do echo "MENU ${cat} {" for app in $(find /usr/share/applications -name '*.desktop' | xargs grep -l "Categories=.*${cat};") do # not intended for grep -q '^NoDisplay=true' $app && continue grep -q '^OnlyShowIn=' $app && continue eval $(grep '^Exec=' $app | sed -e 's|=\(.*\)|="\1"|g') eval $(grep '^Name=' $app | sed -e 's|=\(.*\)|="\1"|g') echo -e '\t'\"${Name}\" EXEC \"${Exec%% *}\" done | sort -f echo "}" done