Last updated on November 11, 2020 by Dan Nanni
If you have a program you use regularly on Linux desktop, you may want to create a desktop shortcut, so you can launch the program by simply clicking on the shortcut. While most GUI programs automatically create their desktop shortcut during installation, GUI programs built from their source or terminal applications may require you to set up associated shortcuts manually.
In this tutorial, I will describe how to create a desktop shortcut or launcher in various Linux desktop environments.
A desktop shortcut is represented by a corresponding
.desktop file which contains meta information of a given app (e.g., name of the app, launch command, location of icon file, etc.). Desktop shortcut files are placed in
~/.local/share/applications. The former directory stores desktop shortcuts that are available for every user, while the latter folder contains shortcuts created for a particular user only.
To manually create a desktop shortcut for a particular program or command, you can create a
.desktop file using any text editor, and place it in either
~/.local/share/applications. A typical
.desktop file looks like the following.
[Desktop Entry] Encoding=UTF-8 Version=1.0 # version of an app. Name[en_US]=yEd # name of an app. GenericName=GUI Port Scanner # longer name of an app. Exec=java -jar /opt/yed-3.11.1/yed.jar # command used to launch an app. Terminal=false # whether an app requires to be run in a terminal. Icon[en_US]=/opt/yed-3.11.1/icons/yicon32.png # location of icon file. Type=Application # type. Categories=Application;Network;Security; # categories in which this app should be listed. Comment[en_US]=yEd Graph Editor # comment which appears as a tooltip.
Besides manually create
.desktop file, there are various desktop-specific ways to create an application shortcut, which I am going to cover in the rest of the tutorial.
In GNOME desktop, you can use
gnome-desktop-item-edit to configure a desktop shortcut easily.
$ gnome-desktop-item-edit ~/.local/share/applications --create-new
In this example,
gnome-desktop-item-edit will automatically create a desktop launcher file in
~/.local/share/applications. To customize icon location and other info, you may have to edit the
.desktop file manually afterward.
gnome-desktop-item-edit is not available (e.g., on Ubuntu), you can install it as follows.
$ sudo apt-get install --no-install-recommends gnome-panel
kickoff is the default application launcher in KDE desktop. Adding a new application shortcut to
kickoff is straightforward.
First, right-click on
kickoff icon located at the left bottom corner of your desktop, and then choose
Edit Applications menu.
Click on an appropriate category (e.g.,
Utilities) under which you want to create a shortcut, and click on
New Item button on the top. Type in the name of the app.
Finally, fill in the meta information of the app being launched by the shortcut.
If you are on Xfce desktop, right-click on the desktop background, and then select
Create Launcher menu. Then fill out the details of the shortcut.
If you are on Linux Mint Cinnamon desktop, you can create an application launcher by right-clicking on the desktop background, and selecting
Create Launcher menu.
On LXDE desktop, simply right click on the desktop background, and choose
Create New Shortcut.
Please note that this article is published by Xmodulo.com under a Creative Commons Attribution-ShareAlike 3.0 Unported License. If you would like to use the whole or any part of this article, you need to cite this web page at Xmodulo.com as the original source.