Discussion:
Getting the right xdg-menu category name given a xdg-desktop file?
José Félix Ontañon
2014-05-12 16:26:26 UTC
Permalink
Hi,

I'm trying to build an app that automatizes the excluding of some launchers
from menu, by tweaking ~/.config/xdg/menus I've noticed the Categories in
the xdg-desktop aren't the same as the menu names in xdg-menu.

So, the question is given a .desktop file, how to know the name of it's
corresponding menu?

::Example::

The firefox desktop file has as categories:
Categories=GNOME;GTK;Network;WebBrowser;

But the the menu names that needs to be indicated to exclude firefox from
the menu is Applications->Internet. Below the code produced by Alacarte:

<Menu>
<Name>Applications</Name>
<MergeFile
type="parent">/etc/xdg/menus/gnome-applications.menu</MergeFile>
<Menu>
<Name>Internet</Name>
<Exclude>
<Filename>firefox.desktop</Filename>
</Exclude>
</Menu>
</Menu>

I don't understand how Alacarte got that Applications->Internet path given
the firefox.desktop file.

Regards!
--
J. Félix Ontañón Carmona
Jerome Leclanche
2014-05-12 16:41:57 UTC
Permalink
If you're looking for code,
https://github.com/lxde/libqtxdg/blob/master/xdgmenu.cpp is a good
starting point.
J. Leclanche


On Mon, May 12, 2014 at 5:26 PM, José Félix Ontañon
Post by José Félix Ontañon
Hi,
I'm trying to build an app that automatizes the excluding of some launchers
from menu, by tweaking ~/.config/xdg/menus I've noticed the Categories in
the xdg-desktop aren't the same as the menu names in xdg-menu.
So, the question is given a .desktop file, how to know the name of it's
corresponding menu?
Categories=GNOME;GTK;Network;WebBrowser;
But the the menu names that needs to be indicated to exclude firefox from
<Menu>
<Name>Applications</Name>
<MergeFile
type="parent">/etc/xdg/menus/gnome-applications.menu</MergeFile>
<Menu>
<Name>Internet</Name>
<Exclude>
<Filename>firefox.desktop</Filename>
</Exclude>
</Menu>
</Menu>
I don't understand how Alacarte got that Applications->Internet path given
the firefox.desktop file.
Regards!
--
J. Félix Ontañón Carmona
_______________________________________________
xdg mailing list
http://lists.freedesktop.org/mailman/listinfo/xdg
Jasper St. Pierre
2014-05-12 16:53:22 UTC
Permalink
Look at /etc/xdg/menus/gnome-applications.menu:

<!-- Internet -->
<Menu>
<Name>Internet</Name>
<Directory>Network.directory</Directory>
<Include>
<And>
<Category>Network</Category>
<Not><Category>X-GNOME-WebApplication</Category></Not>
</And>
</Include>

<Exclude>
<!-- Utilities exclusions -->
<Filename>vinagre.desktop</Filename>

<!-- Sundry exclusions -->
<Filename>javaws.desktop</Filename>
</Exclude>
</Menu> <!-- End Internet -->

Alacarte loads the existing menu file, notes the category it was in, and
puts an Exclude for it.
Post by Jerome Leclanche
If you're looking for code,
https://github.com/lxde/libqtxdg/blob/master/xdgmenu.cpp is a good
starting point.
J. Leclanche
On Mon, May 12, 2014 at 5:26 PM, José Félix Ontañon
Post by José Félix Ontañon
Hi,
I'm trying to build an app that automatizes the excluding of some
launchers
Post by José Félix Ontañon
from menu, by tweaking ~/.config/xdg/menus I've noticed the Categories in
the xdg-desktop aren't the same as the menu names in xdg-menu.
So, the question is given a .desktop file, how to know the name of it's
corresponding menu?
Categories=GNOME;GTK;Network;WebBrowser;
But the the menu names that needs to be indicated to exclude firefox from
<Menu>
<Name>Applications</Name>
<MergeFile
type="parent">/etc/xdg/menus/gnome-applications.menu</MergeFile>
<Menu>
<Name>Internet</Name>
<Exclude>
<Filename>firefox.desktop</Filename>
</Exclude>
</Menu>
</Menu>
I don't understand how Alacarte got that Applications->Internet path
given
Post by José Félix Ontañon
the firefox.desktop file.
Regards!
--
J. Félix Ontañón Carmona
_______________________________________________
xdg mailing list
http://lists.freedesktop.org/mailman/listinfo/xdg
_______________________________________________
xdg mailing list
http://lists.freedesktop.org/mailman/listinfo/xdg
--
Jasper
José Félix Ontañon
2014-05-19 15:19:02 UTC
Permalink
It was finally done in the spirit of alacarte, using the xdg-ruby library
by C.L. Ramsey https://github.com/dark-yux/xdg-ruby
Now a chef-recipe is ready, allowing sysadmins to modify users menu:
https://github.com/gecos-team/gecos-workstation-management-cookbook/blob/desktop_menu/providers/desktop_menu.rb

Thanks Jasper, Jerome. Your tips have driven me to the solution.
Post by Jasper St. Pierre
<!-- Internet -->
<Menu>
<Name>Internet</Name>
<Directory>Network.directory</Directory>
<Include>
<And>
<Category>Network</Category>
<Not><Category>X-GNOME-WebApplication</Category></Not>
</And>
</Include>
<Exclude>
<!-- Utilities exclusions -->
<Filename>vinagre.desktop</Filename>
<!-- Sundry exclusions -->
<Filename>javaws.desktop</Filename>
</Exclude>
</Menu> <!-- End Internet -->
Alacarte loads the existing menu file, notes the category it was in, and
puts an Exclude for it.
Post by Jerome Leclanche
If you're looking for code,
https://github.com/lxde/libqtxdg/blob/master/xdgmenu.cpp is a good
starting point.
J. Leclanche
On Mon, May 12, 2014 at 5:26 PM, José Félix Ontañon
Post by José Félix Ontañon
Hi,
I'm trying to build an app that automatizes the excluding of some
launchers
Post by José Félix Ontañon
from menu, by tweaking ~/.config/xdg/menus I've noticed the Categories
in
Post by José Félix Ontañon
the xdg-desktop aren't the same as the menu names in xdg-menu.
So, the question is given a .desktop file, how to know the name of it's
corresponding menu?
Categories=GNOME;GTK;Network;WebBrowser;
But the the menu names that needs to be indicated to exclude firefox
from
Post by José Félix Ontañon
<Menu>
<Name>Applications</Name>
<MergeFile
type="parent">/etc/xdg/menus/gnome-applications.menu</MergeFile>
<Menu>
<Name>Internet</Name>
<Exclude>
<Filename>firefox.desktop</Filename>
</Exclude>
</Menu>
</Menu>
I don't understand how Alacarte got that Applications->Internet path
given
Post by José Félix Ontañon
the firefox.desktop file.
Regards!
--
J. Félix Ontañón Carmona
_______________________________________________
xdg mailing list
http://lists.freedesktop.org/mailman/listinfo/xdg
_______________________________________________
xdg mailing list
http://lists.freedesktop.org/mailman/listinfo/xdg
--
Jasper
--
J. Félix Ontañón Carmona
Consultor Externo

Emergya Consultoría
Tfno: +34 954 51 75 77 / +34 661 91 27 26
Fax: +34 954 51 64 73
www.emergya.es
Loading...