Duplicate application icons in Ubuntu dock upon launch
Solution 1:
You need to add a proper StartupWMClass
line to the .desktop
launcher corresponding to the application (refer to this). Follow these steps:
- Open Files and go to your
/usr/share/applications
folder. Look for the "Nightly" file (i.e. the launcher for the application you want to fix) and copy it. - Paste the file in
~/.local/share/applications
. It should look like a file with the name<filename>.desktop
. - Right click on this
.desktop
file and open with Text Editor. - Launch "Nightly" (i.e. the application you want to fix) from "Activities".
- Run
xprop WM_CLASS
in Terminal. - Place the cursor over the opened "Nightly" window. The cursor should turn into a crosshair already. Click. You should get a
WM_CLASS
string for "Nightly" in Terminal. -
In the
.desktop
file opened in Text Editor add the following lineStartupWMClass=OBTAINED-VALUE
In place of
OBTAINED-VALUE
put a value you got from step 6 without any quotes. - Save the
.desktop
file.
Solution 2:
related to :
Kile icon buggy in left (launcher) bar (ubuntu 18.04)
On ubuntu 18.04
- open the file :
org.kde.kile.desktop
- at :
/usr/share/applications
- add this line at the end of file :
StartupWMClass=kile
- press ALT+F2, r
It works for me
Solution 3:
Ubuntu 20.04 on Wayland
- Press Alt + F2
- Type "lg" and hit Enter (Looking Glass)
- Click on the "Windows" tab.
- You should see the titles of all your windows. Below each one you will find a
wmclass
property. Write down or copy the value you see. - Open up the
.desktop
config file corresponding to your application. It should be in the~/.local/share/applications/
folder. - On a new line add
wmclass=VALUE_FROM_ABOVE
In my case for Firefox it was "Firefox Developer Edition" and I had to add the line below to my .desktop
file:
wmclass=Firefox Developer Edition