Dashes and underscores in desktop file IDs

Simon McVittie smcv at collabora.com
Wed Oct 11 11:28:08 UTC 2017

For historical reasons, D-Bus well-known bus names allow both dashes
and underscores (but D-Bus object paths and interface names don't allow
dashes). The Desktop Entry Specification has inherited this oddity.
This causes intermittent problems in adjacent specifications like
Flatpak app IDs and the DBusActivatable API, where there need to be
strange special cases if you happen to own a domain name containing
dashes, most recently
<https://github.com/parnold-x/nasc/issues/67> and

Relatedly, it isn't obvious what to do if your domain name contains
a label (element) starting with a digit. I would like to clarify this
by putting some recommendations and anti-recommendations in the
relevant specifications, so that the story is clearer for app authors.
It would be a compatibility break to actually *forbid* one or the other,
but I think we can safely recommend against it (as in SHOULD NOT rather
than MUST NOT).

I personally think the recommendation should be:

* Don't use dashes in new app IDs
* Replace dashes with underscores
* Prepend an underscore to elements that would otherwise start with a

and I've proposed some possible patches for the Desktop Entry spec on
<https://bugs.freedesktop.org/show_bug.cgi?id=103216>. The D-Bus
Specification should also have a corresponding change, when we've
agreed on what the change should be.

If there is consensus that the recommendation should be dashes and not
underscores, I'd be willing to go with that instead, but I think we
should pick one.

Unfortunately it looks as though the AppStream spec currently allows
dashes but not underscores, which (if enforced) conflicts fairly badly
with Flatpak renaming AppStream XML that doesn't match the Flatpak app
IDs (underscores but not dashes). Would the maintainers of AppStream
be willing/able to relax the spec for <id> to allow underscores?
If not, then I think the AppStream spec should explain what you should
do if your desktop file ID contains an underscore (presumably replacing
it with a dash).



More information about the xdg mailing list