1

According to my understanding of the File Naming section in the XDG Desktop Entry Specification, I should name my .desktop file following reverse-DNS notation:

The name of the desktop entry should follow the "reverse DNS" convention: it should start with a reversed DNS domain name controlled by the author of the application, in lower case. The domain name should be followed by the name of the application, which is conventionally written with words run together and initial capital letters (CamelCase). For example, if the owner of example.org writes "Foo Viewer", they might choose the name org.example.FooViewer, resulting in a file named org.example.FooViewer.desktop.

Naming the desktop file this way and placing it in XDG_DATA_HOME/applications and then running xdg-desktop-menu forceupdate afterwards does indeed result in my application showing up in all the usual places.. except for gnome. For some reason, my application won't show up in the "Recommended Applications", Gnome's equivalent to the "Open with.." in other File Managers/Desktop Environments.

The desktop is valid according to desktop-file-validate.

After a quite a bit of digging, I came across recommendations to use another program, xdg-desktop-menu install to validate the file. When I did, it produced the following error:

xdg-desktop-menu: filename 'org.example.FooViewer.desktop' does not have a proper vendor prefix A vendor prefix consists of alpha characters ([a-zA-Z]) and is terminated with a dash ("-"). An example filename is 'example-org.example.FooViewer.desktop' Use --novendor to override or 'xdg-desktop-menu --manual' for additional info.

When I tried this by removing the reverse DNS notation and just naming the file example-FooViewer.desktop, it finally showed up in gnome.

Now I'm confused. Why is gnome breaking when I name my file according to the spec? Why does xdg-desktop-menu deny processing this file despite it conforming to the spec? Why is gnome NOT breaking for other similarly-named desktop entry files - all Flatpaks show up in gnome's "open with" menu despite their desktop entries being named in reverse-DNS notation and most not containing vendor prefixes or so much as a single dash!

What is going on here? and how should I handle this conflict as an independent third-party packager? Am I missing something?

1 Answer 1

1
+100

Why does xdg-desktop-menu deny processing this file despite it conforming to the spec?

Because xdg-desktop-menu checking of the vendor prefix does not precisely implement the conditions as specified in the specification you quoted in OP.

As we can read into the code of the check_vendor_prefix() function (starting from line 521), the condition for going through successfully is triggered by the following test :

case "$file" in
   [a-zA-Z]*-*)

Case being matched if the filename given as parameter to the command starts with an alphabetical characters and contains at least one dash

And there is just no dash in org.example.FooViewer.desktop.

Therefore, If you wish to use xdg-desktop-menu for installing your .desktop file, simply follow the advise given in the error message :

Use --novendor to override update-desktop-database


Why is gnome NOT breaking for other similarly-named desktop entry files - all Flatpaks show up in gnome's "open with" menu

I cannot tell regarding your other desktop entries but flatpacks installations trigger the execution of :

3
  • 1
    Shell case label is a 'glob' pattern NOT a regexp; the one you quote means one alpha (usually, but weird locales may have nonalpha in those ranges), then any number of any characters, then one hyphen, then any number of any characters. (Well, any character(s) except NUL, which most shells can't handle, and anyway can't ever occur in a filename or part of one which $1 here is.) Jan 23, 2023 at 1:33
  • @dave_thompson_085 : I stand corrected. Thanks for noticing.
    – MC68020
    Jan 23, 2023 at 4:43
  • Thank you! While this post doesn't provide an answer to my primary question, the second part does provide enough new information (to me) that I can use to further investigate this issue when I have more time. As such, I'll gladly award you the bounty but will leave the question open. (My solution for now is to ignore gnome and focus on KDE and other conforming desktops) Jan 24, 2023 at 17:42

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .