wayland: group windows by app_id only when appicon is docked

This commit is contained in:
lkn 2026-06-21 19:10:07 +02:00
parent 58bb6f08b4
commit bebd22cbd7
1 changed files with 18 additions and 3 deletions

View File

@ -750,13 +750,28 @@ WWindow *wManageWindow(WScreen *scr, WNativeWindow window)
wwin->main_window = wwin->client_win;
/* Wayland native clients have no client_leader or window_group.
* Treat each non-transient window as its own app leader so that
* wApplicationCreate runs and an appicon is produced. */
* If a matching docked icon exists, group by app_id (wm_class) so
* all instances share one appicon. Otherwise each gets its own. */
if (wwin->main_window == WM_NATIVE_NONE
&& wwin->transient_for == WM_NATIVE_NONE
&& wwin->client_leader == WM_NATIVE_NONE
&& wwin->group_id == WM_NATIVE_NONE)
&& wwin->group_id == WM_NATIVE_NONE) {
wwin->main_window = wwin->client_win;
if (wwin->wm_class) {
WWindow *tmp;
for (tmp = scr->focused_window; tmp; tmp = tmp->next) {
if (tmp != wwin && tmp->wm_class
&& strcmp(tmp->wm_class, wwin->wm_class) == 0
&& tmp->main_window != WM_NATIVE_NONE
&& wApplicationOf(tmp->main_window)
&& wApplicationOf(tmp->main_window)->app_icon
&& wApplicationOf(tmp->main_window)->app_icon->docked) {
wwin->main_window = tmp->main_window;
break;
}
}
}
}
fixLeaderProperties(wwin);