1
0
mirror of https://github.com/gryf/wmaker.git synced 2026-03-19 09:13:33 +01:00

wmaker: set proper group window class when hint is empty

This patch is setting a proper class hint internally
when the app is not setting any.
That issue can be reproduced with terminator 2.1.3,
where the window itself is setting a proper WM_CLASS

$ xprop|grep WM_CLASS
WM_CLASS(STRING) = "terminator", "Terminator

But the window id # of group leader: 0x1000001
is setting only the instance name not the class name.
$ xprop -id 0x1000001|grep CLASS
WM_CLASS(STRING) = "terminator", ""

The issue is that wmaker is using those 2 string values
for the dock apps and to identify linked launched apps.
Those strings are concatenated and used in WMWindowAttributes.
Without the patch, that entry below is created:

  terminator. = {
    Icon = terminator..xpm;
  };

If wmaker is warm restarted, a new entry appears in WMWindowAttributes:

  terminator. = {
    Icon = terminator..xpm;
  };

  terminator = {
    Icon = terminator..xpm;
  };

and the opened window is not linked anymore to the dock app as the
WM_CLASS is different.
So you can launch the app as many times as you want from the dock,
the dock icon will
always have the 3 dots on the bottom left corner showing no window
apps are linked to it.

In case if the group window is not defining a CLASS but the client window
has one, the patch is setting the group window CLASS to the value of the
client window CLASS, or as a fallback, as seen in PropGetWMClass function,
setting it to "default".

With the patch, in WMWindowAttributes, we have now:
  terminator.Terminator = {
    Icon = terminator.Terminator.xpm;
  };

and a warm restart is not creating another entry.
This commit is contained in:
David Maciejak
2026-02-21 14:54:48 -05:00
committed by Carlos R. Mafra
parent 1b8eb63376
commit 073235ada4

View File

@@ -848,6 +848,12 @@ WWindow *wManageWindow(WScreen *scr, Window window)
/* // only enter here if PropGetWMClass() succeeds */
PropGetWMClass(wwin->main_window, &class, &instance);
if (!class || class[0] == '\0') {
if (wwin->wm_class && wwin->wm_class[0] != '\0')
class = strdup(wwin->wm_class);
else
class = strdup("default");
}
buffer = StrConcatDot(instance, class);
index = WMFindInArray(scr->fakeGroupLeaders, matchIdentifier, (void *)buffer);