You are not logged in.

#1 2014-05-02 22:09:47

bsimpson1
Member
Registered: 2014-05-02
Posts: 1

Simple Pekwm Categorized Menu Populator (Shell Script)

I wanted to share this script I wrote in the hope that it will prove to be as convenient to some of you as it has been to me.

Suggestions and modifications are welcome.

#! /bin/sh

#USING WITH PEKWM
#	-Install this file to ~/.pekwm/scripts/menugen.sh
#	-Add this line to ~/.pekwm/start:
#		~/.pekwm/scripts/menugen.sh > ~/.pekwm/dynamic
#	-Add this line where desired to the RootMenu section of ~/.pekwm/menu:
#		INCLUDE = "dynamic"
#	-Reload Pekwm
#	-Restart Pekwm
#This will allow the menu to regenerate each time Pekwm restarts. 

#MAKING ADJUSTMENTS
#Select a list of categories into which you would like your applications to be sorted, then add them to the "CATS=..." line below separated by spaces.
#Some common values are:
#
#	CATEGORY	DESCRIPTION
#	AudioVideo	Application for presenting, creating, or processing multimedia (audio/video)	 
#	Audio		An audio application	Desktop entry must include AudioVideo as well
#	Video		A video application	Desktop entry must include AudioVideo as well
#	Development	An application for development	 
#	Education		Educational software	 
#	Game		A game	 
#	Graphics		Application for viewing, creating, or processing graphics	 
#	Network		Network application such as a web browser	 
#	Office		An office type application	 
#	Science		Scientific software	 
#	Settings		Settings applications	Entries may appear in a separate menu or as part of a "Control Center"
#	System		System application, "System Tools" such as say a log viewer or network monitor	 
#	Utility		Small utility application, "Accessories"	 
#
#For a better idea of how your applications may be categorized, you may also want to inspect the contents of the "Categories=" line of the various *.desktop files under /usr/share/desktop/

CATS="Audio Graphics Network Settings System Utility"

for CAT in $CATS; do
	echo "	Submenu = \"$CAT\" {"
	for CATMATCH in `grep -l "^Categories=.*$CAT.*" /usr/share/applications/*.desktop`; do
			name=`sed -n '1,/^Name=/ s/^Name=//p' <$CATMATCH`
			exec=`sed -n '1,/^Exec=/ s/^Exec=//p' <$CATMATCH`
			echo "		Entry = \"$name\" { Actions = \"Exec ${exec% %[UuFf]}\" }"
	done
	echo "	}"
done

Offline

Board footer

Powered by FluxBB