appFavourites: replace hardcoded rename list with lookups in .desktop files
I noticed that appFavourites.js has a big, hardcoded table of desktop file renamings: https://gitlab.gnome.org/GNOME/gnome-shell/blob/master/js/ui/appFavorites.js#L9-47 .
In Endless, we do something similar by putting the old filename into the .desktop file. For example, our patched org.gnome.gedit.desktop
has the following line:
X-Endless-Alias=gedit
Then our patched shell-app-system.c
maintains a lookup table from X-Endless-Alias + ".desktop"
to new filename. https://github.com/endlessm/gnome-shell/blob/master/src/shell-app-system.c#L133-L138
Flatpak:d apps have something similar. When flatpak-builder
builds a manifest that specifies rename-desktop-file
, it puts the old ID into the renamed .desktop
file. For example, /var/lib/flatpak/exports/share/applications/im.pidgin.Pidgin.desktop
has:
X-Flatpak-RenamedFrom=pidgin.desktop;
I have recently added support for this as well in Endless's modified Shell. (We have a number of Flatpaks in our internal repository which will be replaced on users' systems with newer versions of the same app on Flathub; when the Flathub version has a different ID, the migration process, running on the user's system, will add our old Endless-specific ID for the app to the new .desktop
file.)
I propose to get rid of this hard-coded table in the shell as follows:
- For each app in the table, add
X-Flatpak-RenamedFrom
to the upstream.desktop
file - Upstream Endless's alias logic in
shell-app-system.c
- Delete the lookup table in
appFavourites.js
, using theshell-app-system
logic instead
You could imagine that upstreams would prefer not to have X-Flatpak-RenamedFrom
in the canonical .desktop file. We could invent a non-Flatpak-specific key (I suggest Provides=
, following the <provides><id>
notation in appstream) and make shell-app-system.c understand both.
There would be a couple of advantages to this approach:
- app authors can rename their
.desktop
files without having to send patches to the shell every time. Off the top of my head I can think of several apps I'm involved with who have renamed their .desktop files recently that are not on this list (d-feet.desktop
→org.gnome.dfeet.desktop
,bustle.desktop
→org.freedesktop.Bustle
) and I'm sure there are dozens more - users switching from distro-packaged apps (with non-reverse-DNS desktop file names) to Flatpak:d versions will get their favourites updated for free
- (selfishly, Endless' delta to upstream would be smaller)
I'm happy to write the code and run around filing MRs for these 35 applications, but I'd like to get agreement on the name of the key to use before doing so. (Ideally one would update the desktop entry specification.)