How I customize my Puppy menu (for jwm) - Method 2

How to do things, solutions, recipes, tutorials
Post Reply
Message
Author
kamato
Posts: 2
Joined: Thu 09 Dec 2010, 20:51

How I customize my Puppy menu (for jwm) - Method 2

#1 Post by kamato »

How I customize my Puppy menu (for jwm) - Method 2

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.) Make a copy of the /usr/sbin/fixmenus script:

cp /usr/sbin/fixmenus /usr/sbin/custommenus

2.) Modify your copy of fixmenus (i.e /usr/sbin/custommenus) and make the following changes:

Change this line:

EXECMENU="`echo -n "$ONELINE" | grep -o 'PUPPYMENU.*' | cut -f 2-5

To:

EXECMENU="`echo -n "$ONELINE" |grep -v '#'| grep -o 'USERMENU.*' | cut -f 2-5

Notice the introduction of |grep -v ‘#

This allows the custommenus program to skip commented (#) lines when building the new /root/.jwmrc file. Notice that we have also changed the search string PUPPYMENU to USERMENU.

3.) Now edit /etc/xdg/templates/_root_.jwmrc and make copies of some of the lines that begin with PUPPYMENU that you would like to appear on the user’s custom Menu..

For example if you want the user to see the Internet icon on the custom Menu, just duplicate the Internet line and modify as follows and change the new line to start with USERMENU instead of PUPPYMENU:

PUPPYMENU jwm-xdgmenu /etc/xdg/menus/puppy-internet.menu
USERMENU jwm-xdgmenu /etc/xdg/menus/puppy-internet.menu

When you run the custommenus script in step 2. it will skip the lines that begin with PUPPYMENU and process the lines that start with USERMENU in /etc/xdg/templates/_root_.jwmrc

4.) 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 custommenus script:

jwm -restart

This way anytime I run the custommenus to rebuild the /root/.jwmrc file, JWM will automatically be restarted to display the changes I have made to any of the XDG files.

5.) To add a new menu item, make an entry in /etc/xdg/templates/_root_.jwmrc in the section that have lines beginning with USERMENU:

USERMENU 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

6.) Modify your new *.menu file as necessary:

Below are the contents of my puppy-officeapplications.menu.
# 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

7.) 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 are the contents of my Puppy-officeapplications.directory file.
# cat Puppy-officeapplications.directory

[Desktop Entry]
Encoding=UTF-8
Name=Office Applications
Icon=games24.png
Type=Directory

8.) After cross-checking to make sure steps 5 through 7 have been followed correctly just run custommenus and verify the results.

9.) To hide an application from a menu entry edit the associated *.desktop file and add Hidden=true
to the file. Then run custommenus.

10.) With the above method you can switch between the default root Menu and the customized user menu. Run fixmenus to revert back to the root menu. Run custommenus to see your custom menu. It is that simple.

Marek M.
Posts: 14
Joined: Thu 27 Jan 2011, 09:55

Re: How I customize my Puppy menu (for jwm) - Method 2

#2 Post by Marek M. »

Hi, sorry for popping in late, thanks for the great tutorial. I have a JWM related problem, I'd like to open some programs maximised using groups. Do you have any ideas what I'm doing wrong?

Post Reply