Download raw body.
cwm(1) window-movetogroup-N puts the window in the back
On Mon, Jul 28, 2025 at 01:12:22PM +0200, Walter Alejandro Iglesias wrote:
> 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.
>
Correction to the other diff which had a side effect. Running
group-only-N in the same N group raised the next window in the stack.
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 31 Jul 2025 14:12:12 -0000
@@ -214,6 +214,13 @@ void
group_only(struct screen_ctx *sc, int idx)
{
struct group_ctx *gc;
+ struct client_ctx *cc, *newcc;
+
+ 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;
@@ -224,6 +231,10 @@ group_only(struct screen_ctx *sc, int id
else
group_hide(gc);
}
+
+ newcc = client_current(sc);
+ if (newcc == NULL)
+ client_raise(cc);
}
void
--
Walter
cwm(1) window-movetogroup-N puts the window in the back