If you are using Xorg, Gnome uses an app's WM_CLASS property to locate the instances of an app. Every application has a .desktop file and there is a field named StartupWMClass
. Gnome reads this field to identify the app's instances. Some applications do not include the StartupWMClass
field in its desktop file. This might be causing the issue. To fix it follow these steps:
Go to /usr/share/applications
folder and search for the app's name. You will find a desktop file associated with that app, let's say foo.desktop
. Copy that file to ~/.local/share/applications
(~
stands for the user's home directory).
Open the affected app. Open up a terminal and run xprop WM_CLASS
. The cursor will change to a plus sign. Then click on the affected app. A line will be printed to the terminal something like: WM_CLASS(STRING) = 'foo'
Now open the copied file in step 1 using a text editor. At the end of the file add a line StartupWMClass=<wm_class>
. Replace wm_class
with the output you got in the previous step without quotes. eg.- StartupWMClass=foo
Save the file, then relaunch the app and the problem should be fixed.
Note that this will only work in Xorg because AFAIK, Wayland doesn't require the StartupWMClass
property.