How to create a desktop icon for an executable?

5,925

Solution 1

To get it into the dock:

Once the application is running, its icon will show up in the "dock", next to the other app launchers, on the side of the screen. There you can right-click it, and choose the Add to favorites option, that will persist it in there. This step I believe should be able to help you even before you do any of the following steps below, so it's your quickest first aid for the situation.

To get it onto the desktop:

  1. For an icon on the desktop itself, you need to look for the corresponding *.desktop file: it's comparable to those desktop shortcuts in Windows.

    I look for *.desktop files first in the /usr/share/applications location. If the desired one is not in this location, I am usually stuck, and have no idea where else to look. (Someone please could suggest more ideas?)

  2. You need to copy that *.desktop file to your ~/Desktop directory.

    If you want to override / customize anything in this file, you need to copy it to ~/.local/share/applications/ too: you can modify the copy in there, it will take precedence. Additionally, you would copy this modified variant into ~/Desktop.

  3. You need to ensure that the Desktop Icons gnome-shell-extension is being enabled (which is indispensable for this feature). (Just for a note, in newer Ubuntu releases, it will have a twist on the name, like Desktop Icons NG or somesuch.) See more below:


To manage gnome-shell extensions, on Ubuntu 20.04 (equipped with a Gnome 3 desktop) there seem to be two convenient graphical UI solutions to manage gnome-shell-extensions:

One using the Gnome-tweaks app:

sudo apt install gnome-tweaks

Mind you, in upcoming Gnome versions (starting with Gnome 4, (already available in Ubuntu 21.04, I believe) Tweaks will not be used for managing extensions any more.)

The other is using the "Extensions" app:

sudo apt install gnome-shell-extension-prefs

However, while this works (mind you, in a fashion of being capable of overriding the above Tweaks app (!)), running its name as command in the terminal, it now says it's "deprecated", and points to this Flatpak package variant of it as recommended alternative. (Which is pretty crazy to me, because why would you need to install a third package management discipline on your machine (beyond the default apt, and the additional snap) for such an essential thing as managing gs extensions...)

As I said in my comment above, we are living in "interesting" times.

Solution 2

The following works in KDE, but may also work elsewhere.

If the program is already in your application menu, skip this first section.

Right click on the menu icon. Select Edit Applications

Tab to the appropriate applications folder

Select New Item

Give it a name

A dialog will open that allows you to fill in the fields description and comment and enter the full path to your new application.

Then select Save.

Now your application is in your menu and you can launch it from there.

This will create a .desktop file for you.

If you want to, you can add its icon to your desktop or panel.

Open the application menu and find the icon for your application.

Now, you can drag it to your desktop or panel and it will be added there.

Then, you can right click on the desktop and select unlock widgets.

Once you have done this, you can drag your new icon to wherever you want it on your desktop or panel.

When you're done, right click on the desktop again and select lock widgets.

If you're application doesn't display the icon you want, you can right click on its icon and select Properties.

Click on the icon displayed in the properties and it will let you select another icon from the many it already knows about and will even let you search your file system if you know where the icon you want to use is stored.

Share:
5,925

Related videos on Youtube

Leschge
Author by

Leschge

Updated on September 18, 2022

Comments

  • Leschge
    Leschge over 1 year

    I am new to Linux and this may seem trivial but I can't find a easy solution.
    I downloaded VS Code to my Home directory and unzipped it.

    I know that I have to modify the file with chmod +x code and then run it via ./code in terminal.
    But how do I add it as a desktop icon or even as fav in my taskbar?

    I found this solution (https://askubuntu.com/a/66918), but Gnome Desktop Icon seem to be removed in Ubuntu 20.04.

    • Levente
      Levente almost 3 years
      Don't be hard on yourself. It's not trivial. It used to be, but for whatever reason (and alike many other (even essential) things) it seems to have gotten removed from the Gnome desktop. We are going through such an era. I hope it improves.
    • Bruni
      Bruni almost 3 years
      And until such a time...the manual answers in the question you linked still work.
    • Bruni
      Bruni almost 3 years
      Does this answer your question? How can I create launchers on my desktop?