How can I add custom '.desktop' application launchers to Ubuntu Dock?
Create a
.desktop
file (or, copy if you already have one ready), saymy-chrome.desktop
, in your~/.local/share/applications/
directory.
You may add the following lines to it for a simple, bare-minimum.desktop
launcher[Desktop Entry] Name=My Chrome Comment=Chrome my profile Exec=google-chrome --profile-directory=Default Icon=google-chrome Type=Application Terminal=false
The keys are as described below
Name=
Specific name of the application (For this particular example, I used "My Chrome" to avoid confusion with the already existing Google Chrome launcher. You can use any other name.)Comment=
A short description of the applicationExec=
The command to execute in order to launch the applicationIcon=
Icon for the application (You can use an icon provided by your icon theme or an absolute path to an image file.)
Click 'Activities' or 'Show Applications' and search for "My Chrome" (application name as per the
Name
key). It should appear.Right click on it and select 'add to favourites'.
If right clicking on application icon in dock doesn't show "Add to favourites" option, search for the application in Activities screen, and then drag it across to the dock (suggested by Legolas).
If nothing works, see this Q&A: Cannot add custom launcher to Ubuntu Dock (Add to Favorites)
I had the same problem with Firefox Nightly. The following configuration works for me in ~/.local/share/applications/firefox-nightly.desktop
:
[Desktop Entry]
Type=Application
Name=Firefox Nightly
#
# WARNING: Remember to fix the path in Icon and Exec
#
Icon=/path/to/firefox-nightly/browser/icons/mozicon128.png
Exec=/path/to/firefox-nightly/firefox %u
Terminal=false
StartupWMClass=Nightly
Without StartupWMClass, the running application is not recognized and the icon is displayed twice on the dock.
For anyone having troubles, if the application is not appearing in Activities, make sure you don't have a
NoDisplay=true
line in the .desktop
file for your application.