How to create desktop shortcut launcher on Ubuntu 18.04 Bionic Beaver Linux

Objective

The objective is to show how to create desktop shortcut launcher on Ubuntu 18.04 Bionic Beaver using the default GNOME user interface.

Operating System and Software Versions

  • Operating System: – Ubuntu 18.04 Bionic Beaver
  • Software: – GNOME Shell 3.26.2 or higher

Requirements

Privileged access to your Ubuntu System as root or via sudo command will be required to install new software.

Conventions

  • # – requires given linux commands to be executed with root privileges either directly as a root user or by use of sudo command
  • $ – requires given linux commands to be executed as a regular non-privileged user

Other Versions of this Tutorial

Ubuntu 20.04 (Focal Fossa)

Instructions

In this tutorial we will be creating an example desktop shortcut launcher for Skype application installed on Ubuntu 18.04. First, this guide will show you how to create the desktop shortcut launcher manually while the later example will use application gnome-desktop-item-edit command to simplify the desktop shortcut launcher creating process.

Preparation

Before we can begin you will need the following information for any given application you wish to create shortcut for:

  • Path Application Icon: /snap/skype/23/usr/share/icons/hicolor/256×256/apps/skypeforlinux.png
  • Application name: Skype
  • Path to executable binary: /snap/bin/skype

To obtain a full path to executable binary of any program use which command eg.:

$ which skype
/snap/bin/skype

In regards to the application icon, the choice is yours. You can either head over to /usr/share/icons/hicolor/ directory and search for any relevant icon to use, or simply download new icon from the web.

Create desktop shortcut launcher manually

Now that we have all the necessary information, create a new file Skype.desktop within ~/Desktop directory and paste the following lines as part of the file’s content. Change the code where necessary to fit your application specific details.

$ gedit ~/Desktop/Skype.desktop
#!/usr/bin/env xdg-open
[Desktop Entry]
Version=1.0
Type=Application
Terminal=false
Exec=/snap/bin/skype
Name=Skype
Comment=Skype
Icon=/snap/skype/23/usr/share/icons/hicolor/256x256/apps/skypeforlinux.png


Create Desktop Shortcut launcher - Ubuntu 18.04 - use text editor to enter shortcut code

Use any text editor and enter your Desktop shortcut code.
Create Desktop Shortcut launcher - Ubuntu 18.04 - Save shortcut

Once ready hit Save button. The new shortcut will appear on your desktop.
Create Desktop Shortcut launcher - Ubuntu 18.04 - allow execution as program

Next step is to right-click on the new icon, select Properties-->Permissions-->Allow executing file as program.

Failing to do so will result in the error message:

The application launcher "Skype.dekstop" has not been marked as trusted.
If you do not know the source of this file, launching it may be unsafe.
Create Desktop Shortcut launcher - Ubuntu 18.04 - Trust and Launch

Almost there. Now double click on the new icon and hit Trust and Launch button.
Create Desktop Shortcut launcher - Ubuntu 18.04 - Shortcut created on Ubuntu 18.04

All done.


Desktop Shortcut creation with gnome-desktop-item-edit

The gnome-desktop-item-edit command may be missing as it is not installed by default. You can install it by opening up terminal and entering the following linux command:

$ sudo apt-get install --no-install-recommends gnome-panel

To create a new desktop shortcut launcher on Ubuntu 18.04 execute the following linux command:

$ gnome-desktop-item-edit ~/Desktop/ --create-new
Create Desktop Shortcut launcher - Ubuntu 18.04 - gnome-desktop-item-edit

Create Desktop Shortcut launcher - Ubuntu 18.04 - Fill in all required information

Fill in all required information and hit OK button.
Create Desktop Shortcut launcher - Ubuntu 18.04 - shortcut will be created on your Desktop

At this stage the new shortcut will be created on your Desktop.
Create Desktop Shortcut launcher - Ubuntu 18.04 - trust and launch application

Now double click on the new icon and hit Trust and Launch button.
Create Desktop Shortcut launcher - Ubuntu 18.04

New shortcut ready.