The Gnome desktop dock (and other similar applications) use the window's WM_CLASS
property to group windows, so different windows with the same class will be grouped together under the same dock icon. Sometimes this is unwanted; most commonly, when gnome-terminal
is used to launch various terminal-based applications. E.g. I have a dock icon to open IRC; I want the newly created window to be grouped under that icon, not the terminal icon.
Traditionally, the solution was to use either the --class
command line parameter that many different frameworks provide, or some hack (like this one) to change the window class. But 1) with the deprecation of set_wmclass()
those --class
parameters are increasingly removed or broken (e.g. gnome-terminal
has such a parameter but it doesn't seem to do anything); 2) with Ubuntu 22.04 LTS switching from X11 to Wayland as default in most cases, none of the previous hacks to change WM_CLASS
work. The Wayland equivalent to the window class seems to be the app ID, but AIUI the functionality to change it is not exposed outside the application the way it is in X11.
Is there a better way to set the window class, or to influence dock grouping in some other way?