How I customize my Puppy menu (for JWM) - Method 1
Posted: Tue 14 Dec 2010, 23:22
How I customize my Puppy menu (for jwm) - Method 1
I have figured out a couple of ways to simplify the customization process for the Puppy Menus.
My intention is to help make it easier to build custom menus for ordinary users by hiding some of the programs that most users may never need as well as group some applications on the menu.
I have tried this on Puppy 5.11 and it works.
Customizing the Menu in Puppy entails making changes to at least one of the following files or adding new files to the respective folders.
/etc/xdg/templates/_root_.jwmrc => This is read by the fixmenus program to rebuild the config file for the jwm program
/etc/xdg/menus/*.menu =>Each menu entry is associated with one of these files. You can create your own file by copying an existing one and modifying it.
/usr/share/desktop-directories/*.directory =>Each file is referenced by a *.menu file above. This is where you label the menu item
/usr/share/applications/*.desktop => This configures the programs that need to run when the applications icons under a menu are clicked.
These are the steps I follow:
1.) Modify the /usr/sbin/fixmenus script by making the below changes
Change this line:
EXECMENU="`echo -n "$ONELINE" | grep -o 'PUPPYMENU.*' | cut -f 2-5
To:
EXECMENU="`echo -n "$ONELINE" |grep -v '#'| grep -o 'PUPPYMENU.*' | cut -f 2-5
Notice the introduction of |grep -v ‘#’
This allows the fixmenus program to skip commented (#) lines when building the new /root/.jwmrc file
2.) Now edit /etc/xdg/templates/_root_.jwmrc and put hash (i.e #) at the beginning of any line that begins with PUPPYMENU that you would like to hide from the menu listing.
For example putting a hash (#) in front of the following lines in the _root_.jwmrc file will hide the Setup and System menu entries.
# PUPPYMENU jwm-xdgmenu /etc/xdg/menus/puppy-system.menu
# PUPPYMENU jwm-xdgmenu /etc/xdg/menus/puppy-setup.menu
3.) To avoid manually having to restart jwm each time the above file is altered I have also added the following line at bottom of the fixmenus script:
jwm -restart
This way anytime I run the fixmenus to rebuild the /root/.jwmrc file, JWM will automatically be run as well to display the changes I have made to any of the XDG files.
4.) To add a new menu item, make an entry in /etc/xdg/templates/_root_.jwmrc in the section that have lines beginning with PUPPYMENU:
PUPPYMENU jwm-xdgmenu /etc/xdg/menus/puppy-officeapplications.menu
Where you place your entry determines the order in which is it will show up on the Menu.
Make a copy of an existing *.menu file and name it to match the above entry in _root_.jwmrc
e.g
# cd /etc/xdg/menus
# cp puppy-fun.menu puppy-officeapplications.menu
5.) Modify your new *.menu file as necessary:
Below is the content of my puppy-officeapplications.menu file.
# cat puppy-officeapplications.menu
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE xfdesktop-menu PUBLIC "-//freedesktop//DTD Menu 0.8//EN" "http://www.freedesktop.org/standards/me ... nu-0.8.dtd">
<Menu>
<Name>OfficeApplications</Name>
<DefaultAppDirs/>
<DefaultDirectoryDirs/>
<AppDir>/opt/kde/share/applications/kde</AppDir>
<Directory>Puppy-officeapplications.directory</Directory>
<Include>
<Category>Office</Category>
<Category>X-Document</Category>
<Category>X-DocumentUtility</Category>
</Include>
</Menu>
Choose the Categories based on the applications you would like to appear in your menu
6.) Go to the /usr/share/desktop-directories folder and create the Puppy-officeapplications.directory file by making a copy of an existing one:
# cd /usr/share/desktop-directories
# cp Puppy-Fun.directory Puppy-officeapplications.directory
Below is the content of my Puppy-officeapplications.directory
# cat Puppy-officeapplications.directory
[Desktop Entry]
Encoding=UTF-8
Name=Office Applications
Icon=games24.png
Type=Directory
7.) After cross-checking to make sure steps 4 through 6 have been followed correctly I just run fixmenus and verify the results.
8.) To hide an application from a menu entry edit the associated *.desktop file and add Hidden=true
to the file. Then run fixmenus
I have figured out a couple of ways to simplify the customization process for the Puppy Menus.
My intention is to help make it easier to build custom menus for ordinary users by hiding some of the programs that most users may never need as well as group some applications on the menu.
I have tried this on Puppy 5.11 and it works.
Customizing the Menu in Puppy entails making changes to at least one of the following files or adding new files to the respective folders.
/etc/xdg/templates/_root_.jwmrc => This is read by the fixmenus program to rebuild the config file for the jwm program
/etc/xdg/menus/*.menu =>Each menu entry is associated with one of these files. You can create your own file by copying an existing one and modifying it.
/usr/share/desktop-directories/*.directory =>Each file is referenced by a *.menu file above. This is where you label the menu item
/usr/share/applications/*.desktop => This configures the programs that need to run when the applications icons under a menu are clicked.
These are the steps I follow:
1.) Modify the /usr/sbin/fixmenus script by making the below changes
Change this line:
EXECMENU="`echo -n "$ONELINE" | grep -o 'PUPPYMENU.*' | cut -f 2-5
To:
EXECMENU="`echo -n "$ONELINE" |grep -v '#'| grep -o 'PUPPYMENU.*' | cut -f 2-5
Notice the introduction of |grep -v ‘#’
This allows the fixmenus program to skip commented (#) lines when building the new /root/.jwmrc file
2.) Now edit /etc/xdg/templates/_root_.jwmrc and put hash (i.e #) at the beginning of any line that begins with PUPPYMENU that you would like to hide from the menu listing.
For example putting a hash (#) in front of the following lines in the _root_.jwmrc file will hide the Setup and System menu entries.
# PUPPYMENU jwm-xdgmenu /etc/xdg/menus/puppy-system.menu
# PUPPYMENU jwm-xdgmenu /etc/xdg/menus/puppy-setup.menu
3.) To avoid manually having to restart jwm each time the above file is altered I have also added the following line at bottom of the fixmenus script:
jwm -restart
This way anytime I run the fixmenus to rebuild the /root/.jwmrc file, JWM will automatically be run as well to display the changes I have made to any of the XDG files.
4.) To add a new menu item, make an entry in /etc/xdg/templates/_root_.jwmrc in the section that have lines beginning with PUPPYMENU:
PUPPYMENU jwm-xdgmenu /etc/xdg/menus/puppy-officeapplications.menu
Where you place your entry determines the order in which is it will show up on the Menu.
Make a copy of an existing *.menu file and name it to match the above entry in _root_.jwmrc
e.g
# cd /etc/xdg/menus
# cp puppy-fun.menu puppy-officeapplications.menu
5.) Modify your new *.menu file as necessary:
Below is the content of my puppy-officeapplications.menu file.
# cat puppy-officeapplications.menu
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE xfdesktop-menu PUBLIC "-//freedesktop//DTD Menu 0.8//EN" "http://www.freedesktop.org/standards/me ... nu-0.8.dtd">
<Menu>
<Name>OfficeApplications</Name>
<DefaultAppDirs/>
<DefaultDirectoryDirs/>
<AppDir>/opt/kde/share/applications/kde</AppDir>
<Directory>Puppy-officeapplications.directory</Directory>
<Include>
<Category>Office</Category>
<Category>X-Document</Category>
<Category>X-DocumentUtility</Category>
</Include>
</Menu>
Choose the Categories based on the applications you would like to appear in your menu
6.) Go to the /usr/share/desktop-directories folder and create the Puppy-officeapplications.directory file by making a copy of an existing one:
# cd /usr/share/desktop-directories
# cp Puppy-Fun.directory Puppy-officeapplications.directory
Below is the content of my Puppy-officeapplications.directory
# cat Puppy-officeapplications.directory
[Desktop Entry]
Encoding=UTF-8
Name=Office Applications
Icon=games24.png
Type=Directory
7.) After cross-checking to make sure steps 4 through 6 have been followed correctly I just run fixmenus and verify the results.
8.) To hide an application from a menu entry edit the associated *.desktop file and add Hidden=true
to the file. Then run fixmenus