I have a .desktop app that runs a shell script, this shell script runs a python code when the app is double-clicked, and i want to be able to launch it from all the directories on my laptop and to keep the icon stable even if the directories of the image or icon or app was changed!

How can i make my app global?

2 Answers 2


As apparent from the answer of Zany_Zachary suggested, launchers in /usr/share/applications are available for all users. Launchers under ~/.local/share/applications are available for the current user only. When the launcher is in these places, it will be picked up by your desktop menu or launcher. The location /usr/share/applications is a directory in use by the software management system APT of the operating system, so, although it would work, you should not place your custom .desktop files there. Instead, use the folder /usr/local/share/applications. That folder does not exist by default on Ubuntu, so you may need to create it first.

This is how "global" from your title is most readily understood. However, in your question, you suggest that under "global" you understand also something as "portable", i.e., it should continue to work even if the icon or app changed location. Still, you have to obey the conventions of the operating system where to place your icon or executable. So there is no such thing as a "global" .desktop launcher that keeps working irrespective of where you place icon or executable.

There are limits in this "portability". For one thing, the name of the icon or from the executable cannot change, because the name is hardcoded in the .desktop file. However, you can omit the path from the .desktop file, but then, you have to place icon and executable in specific places searched by the operating system.

The icon

The icon is defined in the .desktop file on the Icon= line.

If you only provide the name of the icon (without the extension), the operating system will search ~/.icons and ~/.local/share/icons first, and then search the system wide icon directories mostly under /usr/share/icons and /usr/local/share/icons. A graphics file with .png or .svg extension in one of these folders will be picked up by the menuing system. If no corresponding graphic file is found, the system will revert to a default fallback icon.

The application

The executable is defined in the .desktop file on the Exec= line.

Also here, the system will search predefined paths for an executable a the matching name if no full file path is provided. You can see the folders and their order in which they are searched with the echo $PATH command.

  • 1
    All this is great, but /usr/share/applications is controlled by APT, but /usr/local/share/applications is not. Will recommend to use /usr/local/share/applications instead.
    – N0rbert
    Sep 8, 2020 at 20:39
  • Important. I will correct my answer.
    – vanadium
    Sep 9, 2020 at 6:04


To make your .desktop file global, simply:

Place it in /usr/share/applications

For one account only, place it in /home/$USER/.local/share/applications

Unfortunately, you cannot make the icon stay the same when the image file is moved. I recommend making a folder with your application icon in it. Place this folder in /usr/share.

  • 1
    I think you're supposed to put the icons in /usr/share/icons, then you won't have to provide the full path.
    – Heng Ye
    Sep 9, 2020 at 14:36
  • @HengYe That could work, my suggestion would also work. Now that I think of it, putting it in /usr/share/icons would work better. Sep 9, 2020 at 15:42

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .