28

I want to add a custom program to the favourites of Ubuntu dock, but there is no option for that.

enter image description here

Translating the text in this image (same as above) only says:

  1. All windows

  2. Quit

It also doesn't appear in "Show Applications":
enter image description here

Is there a way for adding the program to both Favourites and Applications menus?

40

This is fairly easy. First, make a desktop application file that follows the freedesktop.org spec, e.g.

[Desktop Entry]
Type=Application
Encoding=UTF-8
Name=MyApplication
Comment=My fancy new application
Exec=my_application
Icon=my_application.png
Terminal=false

If you want this to be usable by anyone on your system, put it in /usr/share/applications. For personal use only, you can put it in ~/.local/share/applications. Look in /usr/share/applications for other examples. Add your icon image to the /usr/share/icons directory, or I assume the ~/.local/share/icons, although I have not tried that last location myself.

Then, you can search for the application by name and drag it to the launcher in the usual way!

| improve this answer | |
  • 2
    This doesnt work anymore on 18.04 :( – Shervin Asgari Oct 14 '18 at 10:19
  • 3
    Shervin: I can verify that this still works on 18.04, both using /usr/share/applications or ~/.local/share/applications. You may need to restart gnome to update the cache. – Martin W Oct 16 '18 at 21:54
  • 8
    One step is missing from the description to make it work: the .desktop file needs to be executable, so run e.g. chmod a+x eclipse.desktop, see askubuntu.com/questions/1082340/how-to-add-eclipse-to-favorites – dariok Jul 17 '19 at 10:11
  • 3
    For anyone looking to do this from the command line, run dconf read /org/gnome/shell/favorite-apps, and you will get a list which starts like ['firefox.desktop', 'org.gnome.Nautilus.desktop']. Add your new .desktop file to the list and run the appropriately-modified command dconf write /org/gnome/shell/favorite-apps "['firefox.desktop', 'org.gnome.Nautilus.desktop', 'my-app.desktop']". (Be careful since you'll lose your existing favorites if you forget to include them with the dconf write command.) – Ben Mares Feb 17 at 14:31
  • 1
    This answer misses that you have to set the executable bit + mark it as trusted: askubuntu.com/a/1152748/37881 – Robert May 25 at 11:59

Not the answer you're looking for? Browse other questions tagged or ask your own question.