My custom .desktop file appears in Dash as a text file
Solution 1:
If you take a good look in Dash, you will find out that matlab.desktop
does not appear as an application, but the file matlab.desktop
appears in search, or recently used, since you obviously edited it.
The error
The reason is that Dash does not see it as a valid .desktop
file for (at least) the following reason:
- You should not use relative paths in a
.desktop
file (Desktop/Programs/scripts/runMatlab.sh
is relative), but absolute paths.
Other possible reasons could be an invalid icon path or the fact that you call the script without the preceding sh
(if the script is not executable, but given the other information in your question, that seems not to be the case).
Notes
-
Another thing is that if you store the script on what appears to be a local directory, you should not store the
.desktop
file in/usr/share/applications
, but in~/.local/share/applications
. -
There is no need to make a
.desktop
file executable if you run it from Dash or the Launcher. Most launchers in either/usr/share/applications
or~/.local/share/applications
are not. Only if you locate it on- and run it from your Desktop.
Solution 2:
First of all, move the .desktop file to /usr/share/applications/
(global launchers, needs root permission to move file) or to ~/.local/share/applications/
(only for the current user).*
EDIT: When you run desktop-file-install, this is not necessary as it automatically copies the file to /usr/share/applications/
Then, after checking your .desktop file for errors with desktop-file-install filename.desktop
(no output means no errors, but even some warnings may not prevent the launcher from working),
you add it to the Unity dash by running sudo desktop-file-install filename.desktop
(EDIT: root privileges required to access /usr/share/applications/ where global launchers are stored). Please note that this command might add some lines to the original .desktop file.
I hope this solved your problem. Greetings!
(Source: https://help.ubuntu.com/community/UnityLaunchersAndDesktopFiles)