How to add custom shortcuts in Ubuntu

Sometimes on Ubuntu, I run programs that do not come with installer files, but rather are just unzipped into a folder. These typically don’t add their own shortcut, but it’s possible to add your own. With this shortcut, the application will be accessible from the Activites menu, and you will be able to add it as a favourite to your dock.

Shortcuts in GNOME are defined using .desktop files. You will find the definitions for all your existing applications in /usr/share/applications. To create your own shortcut, you just need to create your own .desktop file like these existing ones. Your custom ones can go in ~/.local/share/applications.

Here is an example config I have for Android Studio at ~/.local/share/applications/android-studio.desktop:

[Desktop Entry]
Type=Application
Name=Android Studio
Exec=/home/g/dev/android/studio/bin/studio.sh
Terminal=false
Categories=Development
Icon=/home/g/dev/android/studio/bin/studio.png

This should show up right away if you try seraching your applications for “Android Studio”. If not, wait a few minutes and it will eventually update.