Home » How-to » How to Create a Desktop Shortcut in Ubuntu

How to Create a Desktop Shortcut in Ubuntu

In Windows, you can create shortcuts on your desktop to launch applications since the very first versions. A long time ago, Ubuntu and other distributions with GNOME had that ability too. However, after the GNOME 3 release, the desktop environment design was reworked, and all application shortcuts moved to the new Activities menu. After a few years, the ability to place files and folders on the desktop was removed too.

Regardless, you are still able to use shortcuts for applications and directories using GNOME extensions. But in most cases, you shouldn't. In this article, I will show how to replace shortcuts using new GNOME features and, if you still want to use them, how to create shortcuts in Ubuntu with GNOME.


Table of Contents

What to Replace Shortcuts in Ubuntu

1. Launching Applications

When GNOME 3 was released, there was a significant shift in UI design. Developers introduced a new full-screen Activities menu that includes all applications and offers global search. Also, there is a panel on one edge of the screen where you can place all your favorite applications. In Ubuntu and the GNOME 45 Activities menu looks like this:

Here, you can open a full list of applications by clicking the button with dots:

In the menu, you can group your apps into folders. Just drag and drop the selected app icon over another app icon.

By default in GNOME, the Dash panel is only visible when Activities is opened, but Ubuntu has a Dash-To-Dock extension that makes this panel visible even on desktop:

You can place here all your most-used applications to have fast access to them. Just find the application in the Activities menu, right-click, and select Pin to Dash:

To remove the app from the panel, right-click on it and select Unpin:

Usually the panel can contain 10–15 applications, and that is pretty enough in most cases.

2. Opening Folders

Another use for shortcuts is fast access to folders. And it can be replaced using bookmarks in Nautilus. Just open the folder that you need to save as a bookmark, then press the button with three dots next to the address bar and select Add to Bookmarks:

After this, your folder will appear in the Nautilus sidebar:

This is how the folder shortcuts were supposed to be replaced.

How to Add Desktop Shortcuts in Ubuntu

Previously, the ability to place files and shortcuts on the desktop was implemented in Nautilus. A few years after deciding not to use shortcuts to launch applications by default, the code was removed from Nautilus and moved to the Gnome Shell extension. You can read about it more here. Now, that extension has the name DING (Desktop Images NG). In Ubuntu, this extension is installed by default, and this is why you can see home folder and trash bin shortcuts on your desktop.

1. Manual Way in GUI

The Desktop Icons extension that is installed in Ubuntu by default does not support creating shortcuts using drag-and-drop from the Dash panel or applications menu. So you need to create them manually or use an additional extension. To create a shortcut for an existing application, you just need to copy its *.desktop file from /usr/share/applications to your ~/Desktop folder or directly to the desktop. For example, let's copy the Firefox shortcut. Open Nautilus, then open Other Locations -> Your Root:

Then go to usr -> share -> applications or just run in terminal:

nautilus /usr/share/applications

Then locate the Firefox desktop file using the search and drag it to your desktop:

The shortcut has already appeared, but it does not work. If you try to double-click it, you will get the error message "Invalid permissions on desktop file". To fix this error, you need to make this shortcut file executable. Open the contextual menu for it and click on Properties. Then turn on Execute as a Program switch:

After this, you will see another error with the message "Untrusted desktop file". You can fix it by right-clicking it and then clicking on Allow Launching item:

Finally, when you double-click on this shortcut, it will open the application. If you want to create shortcuts for Flatpak applications, you should look for the desktop file in /var/lib/flatpak/exports/share/applications. And desktop files for Snap applications are placed into /var/lib/snapd/desktop/applications/.

2. Manual Way in Command Line

If you want to create a shortcut for an existing application in the command line, it is also possible. It is even faster and more convenient than in the GUI because you can use bash autocompletion to navigate directories and find the desired application. I will provide commands that create a shortcut for Firefox. Firstly, copy the desktop file from /usr/share/applications to the Desktop folder in your home dir:

cp /usr/share/applications/firefox.desktop ~/Desktop/firefox.desktop

Then make it executable:

chmod ugo+x ~/Desktop/firefox.desktop

And finally, make it trusted:

gio set ~/Desktop/firefox.desktop metadata::trusted true

After this, you can launch this shortcut in the GUI.

3. Add to Desktop Extension

There is also an extension that adds the "Add to Desktop" button to the contextual menu for all applications in the main menu. You can install it here. Simply turn on the switch and then confirm installation by pressing the "Install" button:

When the extension is installed, you can right-click any application icon in the menu and select the Add to Desktop item to create its shortcut:

4. GTK4 DING Extension

There is also a port of the DING extension to GTK4 and libadwaita that allows you to create shortcuts by dragging and dropping applications from Dash to desktop, among other improvements. To install it, disable the original DING first. Open the Extensions app, find DING, and then turn it off:

After this, install GTK4-DING from the extensions.gnome.org. If your browser is already configured to install extensions, simply enable it on the extensions page and confirm installation by clicking the Install button:

After this, you can create shortcuts for applications by dragging app icons from the Dash panel. Just press Shift, drag the app to the desktop, and its shortcut will appear immediately:

You even don't need to change its permissions or allow launching. The shortcut will be working by default.

How to Create a Custom Shortcut in Linux

If your application does not have a desktop file or you want to create a custom desktop file with specific launch options, it is very easy. All desktop files have the following structure:

[Desktop Entry]
Version=1.0
Name=<name>
Comment=<description>
Exec=<executable_file_and_options>
Icon=<icon_path>
Terminal=false
Type=Application
Categories=<categories>

The most important parameter here is the Exec parameter. It specifies the path to the application executable file and the launching options. If you want to see an icon for your application, you need to specify the path to that icon too. Icons for all installed applications are located in /usr/share/icons/. Icons for Flatpak applications are exported to /var/lib/flatpak/exports/share/icons.

For example, let's create another desktop file for Firefox that will launch the browser in Incognito mode. The executable path is /usr/bin/firefox --private-window and the icon is /usr/share/icons/hicolor/256x256/apps/firefox.png. If you want to add this shortcut to the main menu or  Dash panel, you should place it first in ~/.local/share/applications/. and then on the desktop.

~/.local/share/applications/firefox-private.desktop[Desktop Entry] Version=1.0 Name=Firefox Private Comment=Firefox in private mode Exec=/usr/bin/firefox --private-window Icon=/usr/share/icons/hicolor/256x256/apps/firefox.png Terminal=false Type=Application Categories=Internet

Save the file and ensure that it appears in the main menu, and you can launch it:

After this, you can copy this shortcut to your desktop as described above, give it all permissions, and run your application from the desktop.

If you don't want to edit desktop files manually, you can use the GNOME menu editor alacarte to create a shortcut in Ubuntu. To install alacrate in Ubuntu, run the following command:

sudo apt install alacarte

Then, launch the application and click the New Item button:

Here you can specify a name, executable file with options, comment, and icon:

Fill in all the required information and press the OK button. The new desktop shortcut will appear in the menu, and the desktop file will be placed in ~/.local/share/applications/.

Wrapping Up

In this article, I have explained how to create desktop shortcuts in Ubuntu or other Linux distributions. As you can see, GNOME moves towards simplicity and tends to teach users not to not place application shortcuts and files on the desktop. There are panels, an application menu, bookmarks, and so on for that purpose. However, it is still possible, and you can use your Linux operating system as you wish.

Rate the Article

1 Star2 Stars3 Stars4 Stars5 Stars (No Ratings Yet)
Loading...
Creative Commons License
The article is distributed under Creative Commons ShareAlike 4.0 license. Link to the source is required .

Leave a Comment