[CentOS] Custom desktop menu entries: weird behavior with menu categories

Johnny Hughes johnny at centos.org
Mon Aug 15 15:57:30 UTC 2016


On 08/14/2016 10:13 AM, Nicolas Kovacs wrote:
> Le 14/08/2016 à 11:33, Nicolas Kovacs a écrit :
>> 1. When I edit gnome-terminal.desktop and define "Categories=System;",
>> it won't appear in "Outils systèmes" as expected but remains in
>> "Utilitaires".
>>
>> 2. I have a category "Divers" (something like "Misc") with a single
>> desktop entry for Printer Configuration. Now when I edit
>> system-config-printer.desktop and define something like
>> "Categories=System;", the "Divers" category remains there and the menu
>> entry won't budge.
>>
>> Most of the menu entries can be redefined OK, and they appear in the new
>> category. Why a handful of desktop entries would not work remains a
>> mystery. This looks damn well like a bug, although I wouldn't even know
>> how to call it.
> 
> After some more experimenting, I found the culprit. It looks like the
> structure of the classic Applications menu is not only defined by the
> individual *.desktop files in /usr/share/applications, but also in a
> weird /etc/xdg/menus/gnome-applications.menu file which contains a bunch
> of redundancies. Not exactly KISS principle.
> 
> So it looks like in order to customize my menus, I have to edit
> individual *.desktop files in /usr/share/applications as well as the
> XML-style entries in /etc/xdg/menus/gnome-applications.menu.
> 
> I bluntly admit I don't get the logic behind this sort of thing.

I can't comment on the logic .. I build these, I don't write them :D

But, one thing to check is the spec file for the package that provides
the .desktop file to ensure it is configured as noreplace.  If it is
not, you need to back up your custom files as they will replaced with an
upgrade.

You can find the actual package with :

rpm -q --whatprovides </full/path/to/actual/file>

once you know the rpm, you can find the Source RPM (SRPM) used to build
it like this:

rpm -qi <rpm_name>

once you know the Source RPM name, you can find the spec file here:

https://git.centos.org/summary/rpms!kernel

(substitute the SRPM name for kernel)

Then click on the 'c7' branch link, and on the next screen, click the
'tree' link.

That should take you to a screen with SPECS/ and SOURCES/ .. click
SPECS/ and then the file name of the spec file.  That will open up the
actual spec file used to build the RPM that contains the desktop file.

For example, there are several .desktop files defineed in the
gnome-shell SRPM, and they would be replaced:

https://git.centos.org/blob/rpms!gnome-shell/580c0560105a0f018b62a7e0bdf42eca9b9032f1/SPECS!gnome-shell.spec

That is, they are not set to config(noreplace).

The best thing to do is to keep a copy of all of your modified .desktop
files somewhere else and you can copy them back in if necessary after an
update.

Thanks,
Johnny Hughes


-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 198 bytes
Desc: OpenPGP digital signature
URL: <http://lists.centos.org/pipermail/centos/attachments/20160815/a1661ae9/attachment.sig>


More information about the CentOS mailing list