1

I created a .desktop file to launch an application and saved it to my ~/Desktop folder. It was working until I added another .desktop file. The original .desktop file no longer shows it's configured icon and when I click it just opens in a text editor. Same behavior with the new file. The 'Allow Launching' option is not available when I right-click on the file. In the file properties it has my text editor listed as the default application. Is that correct? Is there another reason why this might not be working?

The .desktop files work fine if I add them to ~/.local/share/applications

Ubuntu 20.04.1 LTS

Edit: The solution by @Matigo worked except instead of dragging the .desktop file directly onto the desktop I had to open my ~/Desktop folder in Nautilus and drag it there. Then I was able to right click and select Allow Launching.

Edit: After further experimenting I found that I could add a new .desktop file manually without using desktop-file-install. If I created a new .desktop file and saved it directly to ~/Desktop then it would work fine. Or if I created the .desktop file in my home dir and dragged it from there it would also work. What doesn't work, and causes all existing shortcuts to stop working, is to drag a .desktop file from a folder in a different partition. I'm not sure why that breaks things but that's what I found. To restore just delete all .desktop files in ~/Desktop and add them again.

1 Answer 1

1

Sounds like you’ll need to use desktop-file-install:

  1. Copy the application launcher to your home directory so that it’s ~/{name}.desktop (Changing {name} to that’s really the file name is)
  2. From the terminal, run: sudo desktop-file-install {name}.desktop.
    This will verify the .desktop file and install it to /usr/share/applications.
  3. Open Nautilus and navigate to /usr/share/applications
  4. Find the icon for the launcher ({name}.desktop) and drag the icon to your desktop

Then do this with the second .desktop file. It’s annoying, but it works.

2
  • It works up until step 4. It won't let me drag the icon to the desktop. @matigo
    – iamthebull
    Dec 19, 2020 at 14:54
  • But it works if I open the Desktop folder in Nautilus and drag it there. Thanks!
    – iamthebull
    Dec 19, 2020 at 15:02

You must log in to answer this question.

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