From bebd22cbd73c99fbbf664b09c5f721e305d65821 Mon Sep 17 00:00:00 2001 From: lkn Date: Sun, 21 Jun 2026 19:10:07 +0200 Subject: [PATCH] wayland: group windows by app_id only when appicon is docked --- src/window.c | 21 ++++++++++++++++++--- 1 file changed, 18 insertions(+), 3 deletions(-) diff --git a/src/window.c b/src/window.c index 06bd6a0..2149bef 100644 --- a/src/window.c +++ b/src/window.c @@ -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);