What will most probably solve your problem is to do the following:
- Open the application
When it is running, open a terminal and type:
xprop WM_CLASS
Then click on the open application window.
The output will look like (example gedit
):
WM_CLASS(STRING) = "gedit", "Gedit"
Use the first part (in this case would be gedit
), to compose a line in your .desktop
file:
StartupWMClass=<string>
(replace <string>
with the actual (first part of the) output of xprop WM_CLASS
, e.g. StartupWMClass=gedit
)
Now try again (you might have to log out / in), most likely the application will appear in the launcher under its own icon.
Explanation
- When an application starts up correctly from a launcher (
.desktop
file), but another icon appears with only a generic icon (question mark), it is most likely that the application window and the launcher do not connect for some reason, and the launcher does not recognize the application's window as "his". This is often the case when a script or a non- standard application (-command) is used. In those cases the StartupWMClass=
line is often the solution.
The use of paths in a .desktop file
In a .desktop
file, you need to use absolute and full paths. Therefore ~
is not expanded.
This is a commonly made mistake :)
Exceptions concerning icons are a.o. described here:
Icon to display in file manager, menus, etc. If the name is an
absolute path, the given file will be used. If the name is not an
absolute path, the algorithm described in the Icon Theme
Specification will be used to locate the icon.
and here:
Icon field is the icon that should be used by the launcher and
represents the application. All icons that are under the directory
/usr/share/pixmaps
don't need to have their full path specified, but
their filename without the extension. For example, if the icon file is
/usr/share/pixmaps/wallch.png
, then the Icon field should be just
'wallch'. All other icons should have their full path
specified.
More information
In a .desktop
file:
In the Icon=
line, you are allowed to use spaces:
Icon=/home/jacob/Thema/icon/some folder/some icon.png
is fine.
However
In the Exec=
line, you are not allowed to use spaces, unless in case of an argument. In all other cases, you need to quote the path steps with a space:
Exec=/home/jacob/Bureaublad/some folder/application
will fail, while
Exec="/home/jacob/Bureaublad/some folder/application"
or
Exec=/home/jacob/Bureaublad/"some folder"/application
will work fine
Best Answer
Short answer:
Remove the quotes in:
Unlike the
Exec
= line, spaces should be left alone in theIcon=
line.Apart from everything, I wouldn't use spaces in a name in general.