site  contact  subhomenews

Document-utility XDG menu category added

February 09, 2013 — BarryK
I have added a new sub-category "utility" under the top-level "Document" menu. For those who are interested in understanding the XDG menu structure in Puppy, this is a good exercise to study (that is, what you see when you click on the "Menu" button at bottom-left of screen).

XDG hierarchy files
Starting at file /etc/xdg/menus/hierarchy, I inserted the "utility" line as shown in this extract from the file:
Document   :Sub            X-Document                                          #

Document :layout X-Document-layout,Publishing,WordProcessor,WebDevelopment #abiword amaya lyx scribus
Document :catalog X-Document-catalog,Dictionary #
Document :edit X-Document-edit,TextEditor #bluefish e3 geany gedit jed joe leafpad medit
Document :viewer X-Document-viewer,Viewer #epdfview xman xpdf
Document :utility X-Document-utility,X-DocumentUtility #PeasyPDF


I then edited /etc/xdg/menus/puppy-document.menu and inserted the new XML code:
  <Menu>

<Name>Document-utility</Name>
<Directory>Puppy-Document-utility.directory</Directory>
<Include>
<Category>X-Document-utility</Category>
<Category>X-DocumentUtility</Category>
</Include>
</Menu>


If you look at the complete file, you will see also that I changed the <separator> tags, don't want a separator between the first two sub-categories.

I then created a new file /usr/share/desktop-directories/Puppy-Document-utility.directory -- note the matching name in the above code.

Thumbnail image
I then created a new thumbnail file, /usr/local/lib/X11/mini-icons/mini-Document-utility.xpm. This is for use in the Puppy Package Manager, which displays a unique icon for each category. Also, when any package is installed (see /usr/local/petget/installpkg.sh), if no icon is found, then the generic icon is used -- for example, if the application is to appear in the "utility" sub-category of the "Document" menu, then 'mini-Document-utility.xpm' is the generic fallback icon.

End usage
What all of the above results in, is if you are creating a PET package with a .desktop file, say /usr/share/application/myapp.desktop, then this line in it will cause the application to appear in the Document-utility sub-category:
Categories=X-Document-utility

...that is, Puppy supports an "absolute addressing" mode for the menu, unlike any other distro. This makes it super-easy to specify where you want your app to appear -- say for example you want it in the "scanner" sub-category of the "Graphic" menu, just do this:
Categories=X-Graphic-scanner
...look in /etc/xdg/menus/hierarchy to see all available sub-categories.

Puppy-pkg-db entry
A further note when creating a PET. For example, 'PeasyPDF' currently has this 'pet.specs' file (pkg db):
peasypdf-2.3|peasypdf|2.3||Document|40K||peasypdf-2.3.pet||Manipulate PDF documents||||
...which is fine. But, you could add a sub-category:
peasypdf-2.3|peasypdf|2.3||Document;utility|40K||peasypdf-2.3.pet||Manipulate PDF documents||||
...which then allows the PPM to assign a more appropriate thumbnail.

Woof commit:
http://bkhome.org/fossil/woof2.cgi/info/774a9fe312

...note, this commit also has recompiled 'welcome1stboot' and 'proxy-setup', which has nothing to do with the XDG menu.

Tags: woof