Geek Stuff Linux Tutorials

Add Linux Apps to App Launcher by Creating .desktop File

Add Linux App To App Launcher By Creating .desktop File

Windows users will be familiar with the concept of creating shortcuts to apps, files or folders. Similar functionality is available on Linux as well but it is often not enabled by default. But shortcuts can be really helpful. You can have your folder, file neatly tucked away in another drive or somewhere else, where it needs to be and still be able to access it right from your desktop. Linux uses such shortcuts to launch installed applications. These shortcuts have a .desktop extension and contain information about the app that needs to be launched. Usually, an app that is installed will automatically create a .desktop file in the right place. Sometimes, they don’t but you can manually create a .desktop file for the app to add it to the app launcher. Let’s see how we can add Linux apps to App Launcher by creating a .desktop file.

Unlike Windows, most Linux apps will not ask you to choose where you want to install them. Also unlike Windows, Linux apps aren’t all located in a single programs folder. Same apps can have bits and pieces scattered all over the system. The desktop file is simply a shortcut that contains information about the location of an app’s executable file, its name, icon, etc. So today we’ll see how you can create a .desktop file for an app which doesn’t create one on its own. Unfortunately, as you use Linux more and more, you’ll find more and more such apps.

I’ll use the Android Messages app for this demonstration. No, by the way, Android Messages does not have a special app for Linux. You can create one though, using Nativefier. And then you’ll have an executable file that you’ll probably want to add to the app launcher. Chances are if you’re here you probably already have such an app. The .desktop files for all the apps you can see in your app launcher are located generally in “~/.local/share/applications” or “/usr/share/applications/” so that’s where we’ll be placing ours as well.

Related article: 5 Best Application Launchers for Linux

Get an Executable App File

Before we do that, make sure you have an executable file. Sometimes, you may even have to make a file executable in order to run it. These are usually scripts with a .sh extension. For instance, app.sh. To make it executable, launch the Files app, click on the Files menu in the top bar and select Preferences. Head to the Behaviour tab and select Run them under Executable Text Files. While you’re at it, also make sure the executable actually works and launched an app. Double-click on it to run it. Once you’re sure the app works, we can go ahead and create a .desktop file for it.

Add Linux App To App Launcher By Creating .desktop File

Creating a .Desktop File to Add Linux Apps to App Launcher

  1. Launch any text editor and paste the following text in an empty file.
    [Desktop Entry]
    Encoding=UTF-8
    Version=1.0
    Type=Application
    Terminal=false
    Exec=/path/to/executable
    Name=Name of Application
    Icon=/path/to/icon
  2. In the text above, you’ll need o change the red parts with the respective information. The exact path to the executable file, including its name, the name you want to be shown in the app launcher for the app and an icon of your choice. Look at the screenshot below for reference, where I’ve added my executable file for the Android Messages app, given it the name “Messages” and provided an icon of my choice. Most apps will provide an icon somewhere inside the archive they provide you with. There’s always google to find one from the internet. Add Linux App To App Launcher By Creating .desktop File
  3. When you’re ready, save the file in the folder~/.local/share/applications/in your home directory. Give the file any name you want but make sure you end it with .desktop. The .local folder is a hidden folder so you’ll have to enable Show Hidden Files in the Files app. If you want the app to be globally available for every user, you can save the file in /usr/share/applications/
    sudo mv ~/.local/share/applications/application-name.desktop /usr/share/applications/

    The above command can be used in a terminal to move the .desktop file saved in the folder~/.local/share/applications/to the folder/usr/share/applications/. Make sure you replace application-name.desktop with the actual name of the .desktop file.

Add Linux App To App Launcher By Creating .desktop File

When you’re done, you should be able to see your app in the app launcher, regardless of which app launcher you use.

Read next: 3 Lightweight Desktop Environments for Linux

Leave a Comment

This site uses Akismet to reduce spam. Learn how your comment data is processed.