Creating own desktop entries for Linux Gnome3

Assuming, you want to install the vanilla Firefox browser or Thunderbird. And you want to have nice starter symbols in Gnome3 as favorites. Here’s how to do it:

Let’s assume, you installed/extracted Thunderbird into the directory ~/programs/thunderbird. Then simply put the following file under ~/.local/share/applications/thunderbird.desktop:

[Desktop Entry]
Name=Thunderbird
Exec=/home/user/programs/thunderbird/thunderbird %u
Icon=/home/user/programs/thunderbird/chrome/icons/default/default48.png
Type=Application

You’ll need to replace /home/user/ with your real directory path.

Gnome3 monitors the directory and should pickup the new desktop entry automatically. You should be able to see it now in the application menu. If it doesn’t appear, you might need to restart Gnome.

Now, on to the Firefox entry. There I had the problem, that Debian ships an own version of Firefox, now the Firefox ESR (Extended Support Release). If I create a simple desktop entry like above, Gnome will pick the icon from Firefox ESR and also groups the windows as if Firefox ESR had been started. But there is also a solution to this issue: How to tell GNOME to separate firefox from firefox-alpha?. We want to separate firefox from firefox-esr. The key to the solution is, to provide a different “window class name” for firefox, which can be done via the --class commandline parameter. The complete desktop entry file for firefox (stored as ~/.local/share/applications/firefox.desktop) looks like this:

[Desktop Entry]
Name=Firefox
Exec=/home/andreas/programs/firefox/firefox --class=VanillaFirefox %u
Icon=/home/andreas/programs/firefox/browser/icons/mozicon128.png
Type=Application
Categories=Network;WebBrowser;
MimeType=text/html;text/xml;application/xhtml+xml;application/xml;application/vnd.mozilla.xul+xml;application/rss+xml;application/rdf+xml;image/gif;image/jpeg;image/png;x-scheme-handler/http;x-scheme-handler/https;
StartupWMClass=Firefox
StartupNotify=true

I took here some more entries from the Debian provided file /usr/share/applications/firefox-esr.desktop.

By the way: Both Firefox and Thunderbird provide the option, to select them as the default applications. They do this by writing a .desktop file to ~/.local/share/applications. They are called e.g. userapp-Firefox-2CFBGY.desktop. However, they have set the key “NoDisplay=true” so these desktop files won’t appear in the menu. The files are merely used for associating the mime types to make them the default applications. See also the file ~/.local/share/applications/mimeapps.list.

References:

Andreas Dangel | subscribe via RSS | adangel | © Copyright 2016. adangel.org (19 February 2017)