From: Walter Alejandro Iglesias Subject: cwm(1) window-movetogroup-N puts the window in the back To: tech@openbsd.org Cc: Okan Demirmen Date: Mon, 28 Jul 2025 13:12:19 +0200 I try to emulate workspaces (or virtual desktops) behavior of most window managers using the following settings in my ~/.cwmrc: bind-key CM-1 group-only-1 bind-key CM-2 group-only-2 bind-key CM-3 group-only-3 bind-key CM-4 group-only-4 bind-key SM-1 window-movetogroup-1 bind-key SM-2 window-movetogroup-2 bind-key SM-3 window-movetogroup-3 bind-key SM-4 window-movetogroup-4 The problem I'm encountering is that when I move a window to another group (using window-movetogroup-N), then switch to the group (using group-only-N) I find that the window has gone to the back instead of the front, as I think it should. The diff below solves the problem. Index: group.c =================================================================== RCS file: /cvs/xenocara/app/cwm/group.c,v diff -u -p -r1.138 group.c --- group.c 27 Jan 2022 18:45:10 -0000 1.138 +++ group.c 28 Jul 2025 10:45:02 -0000 @@ -214,16 +214,27 @@ void group_only(struct screen_ctx *sc, int idx) { struct group_ctx *gc; + struct client_ctx *cc; + + if (TAILQ_EMPTY(&sc->clientq)) + return; + + cc = client_current(sc); + if (cc == NULL) + cc = TAILQ_FIRST(&sc->clientq); + else + cc = client_next(cc); if (sc->group_last != sc->group_active) sc->group_last = sc->group_active; - TAILQ_FOREACH(gc, &sc->groupq, entry) { if (gc->num == idx) group_show(gc); else group_hide(gc); } + + client_raise(cc); } void -- Walter