Advertising

Welcome to SparkyLinux forums
Zapraszamy również na polsko-języczne Forum https://forum.linuxiarze.pl

How to add custom category to FreeDesktop menu

Started by wigwami, October 20, 2023, 11:38:11 PM

Previous topic - Next topic

wigwami

I'm trying to create a custom category to appear in my jgmenu, called File.  I'm talking about a top-level category, not a custom sub menu that appear beneath one of the standard FreeDesktop-defined categories. And I don't want to manually add this category to jgmenu's prepend or append .csv files.

I'm running Sparky with Openbox only so I don't have access to menu editing tools found in Gnome, XFCE, etc. Here's what I've done so far

First, I created a new file.directory file in /usr/share/desktop-directories/.  Here's the content:
[Desktop Entry]
Type=Directory
Encoding=UTF-8
Name=File
Icon=org.xfce.thunar

Second, I created a new XML file called file.menu in /etc/xdg/menus/applications-merged. Here's the content:

<!DOCTYPE Menu PUBLIC "-//freedesktop//DTD Menu 1.0//EN"
 "http://www.freedesktop.org/standards/menu-spec/1.0/menu.dtd">
<Menu>
  <Name>Applications</Name>
  <Menu>
    <Name>File</Name>
    <Directory>file.directory</Directory>
    <Include>
        <Category>File</Category>
    </Include>
  </Menu>
</Menu>

Lastly, I created a new .desktop file called thunar-bulk-rename.desktop in ~/.local/share/applications/.  Here's the content:

[Desktop Entry]
Name=Bulk Rename
Comment=Rename Multiple Files
GenericName=Bulk Rename
Keywords=bulk;renamer;renaming;thunar;files;folders;directory;directories;
Exec=thunar --bulk-rename %F
Icon=org.xfce.thunar
Terminal=false
StartupNotify=true
Type=Application
Categories=Filesystem;Utility;Core;GTK;X-File;

As configured above, the Thunar Bulk Renamer program doesn't move from its original location in the jgmenu Accessories category.  I was told that in the .desktop file, the new category should have X- as a prefix; whether I keep or remove that prefix makes no difference. I also tried removing the other categories from the .desktop file and leaving only X-File (or File). The program appears under a new (yay) category called Other (boo). 

I assume that in both cases, the menu simply doesn't recognize my new, custom category and is defaulting back to either one of the other standard categories or creating the Other category when it doesn't know what else to do.

I must be making an error in either the .directory file or the .menu file but I have no idea what.  Any ideas are welcome, and thanks!

View the most recent posts on the forum