Ubuntu – Cannot add custom launcher to Ubuntu Dock (‘Add to Favorites’ option does not show up)

desktopfavoritesgnome-shellubuntu-dock

I have a custom .desktop file:

[Desktop Entry]
Type=Application
Terminal=false
Icon[en_US]=/home/alex/bin/idea-IC-173.4127.27/bin/idea.png
Name[en_US]=IntelliJ
Exec=/home/alex/bin/idea-IC-173.4127.27/bin/idea.sh
Name=IntelliJ
Icon=/home/alex/bin/idea-IC-173.4127.27/bin/idea.png

Output of ls -lha .local/share/applications/intellij.desktop:

-rwx--x--x 1 alex alex 248 Dez 30 10:54 .local/share/applications/intellij.desktop

Answers posted to a previous question (How can I add custom '.desktop' application launchers to Ubuntu Dock?) don't work for me. I can find this launcher in Activities and I can double click on that file and IntelliJ will start. Nevertheless, I cannot add this launcher as a favorite to the dock. The option does not show up.

Best Answer

Open Terminal and run

gsettings get org.gnome.shell favorite-apps

You should get the list of .desktop files associated to the apps pinned to Ubuntu dock in order, something like the following:

['appname-1.desktop', 'appname-2.desktop', 'appname-3.desktop', 'appname-4.desktop', 'appname-5.desktop']

Suppose you want to pin the app associated to the intellij.desktop file as the second item in the dock. In that case, run

gsettings set org.gnome.shell favorite-apps "['appname-1.desktop', 'intellij.desktop', 'appname-2.desktop', 'appname-3.desktop', 'appname-4.desktop', 'appname-5.desktop']"