Add custom apps to Toolbar, aka “Add to Favorites” in Ubuntu 20.04+

Let’s say you have installed an application using an executable file and not the repositories. If you launch such an application and try to add it to favorites in the Ubuntu dock, you won’t find such an option in the context menu:

no Add to Favorites in Ubuntu

I don’t know why you cannot add to dock custom applications by default. And the only way to add it is to create a launcher manually.

For that, you need to create a yourapp.desktop file in /usr/share/applications/:

sudo nano /usr/share/applications/yourapp.desktop

Paste the following content:

#!/usr/bin/env xdg-open
[Desktop Entry]
Version=1.0
Type=Application
Terminal=false
Exec=/path/to/yourapp
Name=YourApp
Comment=Description of YourApp
Icon=/path/to/yourapp.png

Replace yourapp with your application and save by pressing Ctrl+OEnter and Ctrl+X.

Make this file executable:

sudo chmod +x /usr/share/applications/yourapp.desktop

Log out and log in.

Open the Ubuntu Dash menu and you should be able to find your custom application in the menu. You can launch it from the menu.

custom app in Ubuntu menu

Also, if right-click on it, you should be able to select “Add to Favorites” and pin it to the dock panel:

Add to Favorites for custom app in Ubuntu

Now, when you close this application, a quick launcher will stay in the dock panel.