How to create .desktop shortcut Icon to App Manager in Linux

Before starting the guide, I’ll like to share my scenario with you when I was a neophyte in Linux.

One day I have installed a telegram application from the archive file. The problem was that whenever I need to open the telegram, I need to go to the directory where I have kept the telegram file and start the applications that were too frustrating every time I need to that.

Thanks to the Beloved Linux community, I have solved the so-called problem, not exactly the problem.

When you install any application from the respective repository, you will find the application icon on App manager. But the same condition doesn’t apply when you compile and install applications from the source file or any archive file.

This is very common for Arch-based users; most of the time, they need to build applications from the source file.

Not only arch users other distribution users also struggle sometimes to get the latest applications from an official repository for that they build an application from source.

If you are Debian-based or Red-hat-based, you will find a specific package with the .deb and .rpm for other Linux distributions that need to compile and install from the source.

So, Today I’ll share with you the method through which you can create a .desktop shortcut icon to the App Manager.

Prerequisite

I believe you have already installed the application from the source or archive file or any executable file.

I even assume you have already provided executable permission to the executing file.

To continue this guide please complete the above steps

You just want to create .desktop shortcut icon to the App-manager.

Create Desktop

To create .desktop shortcut icon please follow the below steps.

Step 1:- Check .desktop file

In most of the time, you will get the appname.desktop in a source file. Please check whether the source package contains any .desktop file.

To check .desktop pass the below command

$ ls Downloads/Discord/ |grep .desktop
Check .desktop file

If a .desktop file is present in source or tar package your task is little bit more simple

Step 2:- Move source file

Open a terminal and move the extracted source file to /opt directory

$ sudo mv Downloads/Discord/ /opt
$ ls /opt/
Move source file to /opt

Now get inside the application folder

$ cd /opt/Discord
Cd to /opt/application-name

Inside the application folder you will find the “appname.desktop” you need to move “appname.desktop” to “/home/user-name/.local/share/applications

In my case I’ll move “discord.desktop” to /home/trendoceans/ .local/share/applications.

$ sudo mv discord.desktop /home/trendoceans/.local/share/applications/
mv appname.desktop

Step 3 :- Edit .desktop file

To access an executable file, you need to make a few changes to the .desktop file.

Open your terminal and pass the following command and replace discord .desktop with the application name you are trying to install.

$ sudo nano .local/share/applications/discord.desktop
Change path

We need to change Exec path from /usr/share/discord/Discord to /opt/DirectoryName/ExectuableFile.

Path Updated

Now save and close file, Search Application name in App Manager.

Search Application Name

Read this post for complete guide How to Install Discord on Ubuntu 20.10

Wrap-up

That’s it to create a .desktop shortcut file in Linux, and In the next couple of days, we will guide how to create a new or missing .desktop file.

If you are stuck or need any assistance, please let us know in the comment section till you drink a cup of coffee. If you want me to join, please buy for me too 🙂

This Post Has 2 Comments

    1. Jake Redfield

      We kept it for the future because right now we want a solution that works almost on all distribution. But soon we will cover arronax also.

Leave a Reply