Pages

28/04/2020

[GNOME] Create application shortcut that can be added to favorites

Some applications you install come as archives that you extract in a desired location. However, not all come with an installer that takes care of creating the proper application entries, leaving the task to the user.

You can add a shortcut for any application by creating a file APPLICATION_NAME.desktop under /usr/share/applications and adding this content:

[Desktop Entry]
Version=1.0
Encoding=UTF-8
Type=Application
Terminal=false
Categories=OPTIONAL_CATEGORY_LIST

GenericName=APPLICATION_NAME
Comment=OPTIONAL_COMMENT
Name=APPLICATION_NAME
Path=FULL_PATH_TO_APPLICATION_FOLDER
Exec=FULL_PATH_TO_APPLICATION_EXECUTABLE

Icon=OPTIONAL_FULL_PATH_TO_ICON

StartupWMClass=APPLICATION_WM_CLASS



For example:

[Desktop Entry]
Version=1.0
Encoding=UTF-8
Type=Application
Terminal=false
Categories=IDE;Development

GenericName=ApacheDS
Comment=ApacheDS
Name=ApacheDS
Path=/opt/ApacheDirectoryStudio/
Exec=/opt/ApacheDirectoryStudio/ApacheDirectoryStudio

Icon=/opt/ApacheDirectoryStudio/icon.xpm

StartupWMClass=Apache Directory Studio 


If you want the ability to "Add to favourite" your application in the dock, it is very important that you set the correct value for the StartupWMClass attribute. You can easily find it with xprop.

No comments:

Post a Comment

With great power comes great responsibility