I've created a custom launcher file:
[Desktop Entry]
Type=Application
Name=P4V
Comment=Perforce Visual Client
Icon=/usr/lib/p4v/P4VResources/icons/P4-V_128x128.png
Exec=/usr/bin/p4v
Terminal=false
Categories=Development;
And dragged this file to my launcher. However, when I click the icon, it opens the application under a 2nd, different icon (I click the top one, it opens the application under the bottom one):
The bottom icon isn't present until after I launch the application using the top P4v icon that I manually added.
Best Answer
If an application produces a second icon, not being a generic one
If an application generates a second icon in the Unity launcher other than a a grey, generic icon, there must be already an (other) existing launcher, calling
p4v
in its main command:An application's
.desktop
file by definition has a "main" command in the first line, starting withExec=
. This is the command that is run when the icon is clicked in the (Unity
) launcher. Apart from that, a.desktop
file can have one or more shortcut- sections, available when you right-click on the representing icon in theUnity
launcher.Multiple .desktop files calling the same application in their main command
The symptoms you are experiencing can happen when more than one
.desktop
file in either/usr/share/applications
or~/.local/share/applications
have the same ("main-") command in their firstExec=
line, but the files are differently named.P4v by default should install (and probably has installed) a
.desktop
file, namedp4vasp.desktop
in/usr/share/applications
.How to fix
Your problem should be fixed if you remove your own (probably local)
.desktop
file, then runp4v
from Dash and pin it to the launcher.What if you want to customize the existing launcher?
If you want to change the
.desktop
file's behaviour or e.g. its icon:/usr/share/applications
to~/.local/share/applications
gedit
(drag it over an openedgedit
window) and make the changes you'd like.desktop
file will overrule the global one.To revert, simply remove the local one, log out and back in.
Related to this post