Re: cwm: add group-last command [Was: Re: cwm: add last-group command]

2022-01-26 Thread Omar Polo
Marcus MERIGHI  writes:

> Hello,
>
> I just stumbled over this and thought it deserves a friendly ping.
>
> Marcus

thanks for the interest in the diff :)

here's the diff re-attached for convenience, I've been using it for
almost two years now!  Quoting my original email:

> The attached patch adds a group-last command for cwm.  Admittedly,
> group-last probably makes sense only in sticky group mode; all it does
> is switching to the last group.
>
> I haven't added a default keybinding, so to test you have to add
> something like this to your .cwmrc
>
>   bind-key 4-Tab group-last

Cheers


Index: calmwm.h
===
RCS file: /home/cvs/xenocara/app/cwm/calmwm.h,v
retrieving revision 1.375
diff -u -p -r1.375 calmwm.h
--- calmwm.h16 Apr 2020 13:32:35 -  1.375
+++ calmwm.h26 Jan 2022 18:48:19 -
@@ -214,6 +214,7 @@ struct screen_ctx {
struct region_q  regionq;
struct group_q   groupq;
struct group_ctx*group_active;
+   int  group_last;
Colormap colormap;
Visual  *visual;
struct {
@@ -501,6 +502,7 @@ void 
kbfunc_client_toggle_group(void 
 voidkbfunc_client_movetogroup(void *, struct cargs *);
 voidkbfunc_group_toggle(void *, struct cargs *);
 voidkbfunc_group_only(void *, struct cargs *);
+voidkbfunc_group_last(void *, struct cargs *);
 voidkbfunc_group_close(void *, struct cargs *);
 voidkbfunc_group_cycle(void *, struct cargs *);
 voidkbfunc_group_toggle_all(void *, struct cargs *);
Index: conf.c
===
RCS file: /home/cvs/xenocara/app/cwm/conf.c,v
retrieving revision 1.253
diff -u -p -r1.253 conf.c
--- conf.c  19 Nov 2021 19:13:14 -  1.253
+++ conf.c  26 Jan 2022 18:48:19 -
@@ -139,6 +139,7 @@ static const struct {
 
{ FUNC_SC(group-cycle, group_cycle, (CWM_CYCLE_FORWARD)) },
{ FUNC_SC(group-rcycle, group_cycle, (CWM_CYCLE_REVERSE)) },
+   { FUNC_SC(group-last, group_last, 0) },
{ FUNC_SC(group-toggle-all, group_toggle_all, 0) },
{ FUNC_SC(group-toggle-1, group_toggle, 1) },
{ FUNC_SC(group-toggle-2, group_toggle, 2) },
Index: cwmrc.5
===
RCS file: /home/cvs/xenocara/app/cwm/cwmrc.5,v
retrieving revision 1.76
diff -u -p -r1.76 cwmrc.5
--- cwmrc.5 16 Apr 2020 13:32:35 -  1.76
+++ cwmrc.5 26 Jan 2022 18:48:19 -
@@ -273,6 +273,8 @@ menu.
 Toggle visibility of group n, where n is 1-9.
 .It group-only-[n]
 Show only group n, where n is 1-9, hiding other groups.
+.It group-last
+Show only the last viewed group.
 .It group-close-[n]
 Close all windows in group n, where n is 1-9.
 .It group-toggle-all
Index: group.c
===
RCS file: /home/cvs/xenocara/app/cwm/group.c,v
retrieving revision 1.137
diff -u -p -r1.137 group.c
--- group.c 27 Feb 2020 14:56:39 -  1.137
+++ group.c 26 Jan 2022 18:48:19 -
@@ -215,6 +215,9 @@ group_only(struct screen_ctx *sc, int id
 {
struct group_ctx*gc;
 
+   if (sc->group_active->num != idx)
+   sc->group_last = sc->group_active->num;
+
TAILQ_FOREACH(gc, >groupq, entry) {
if (gc->num == idx)
group_show(gc);
Index: kbfunc.c
===
RCS file: /home/cvs/xenocara/app/cwm/kbfunc.c,v
retrieving revision 1.170
diff -u -p -r1.170 kbfunc.c
--- kbfunc.c20 Mar 2020 18:50:08 -  1.170
+++ kbfunc.c26 Jan 2022 18:48:19 -
@@ -479,6 +479,14 @@ kbfunc_group_only(void *ctx, struct carg
 }
 
 void
+kbfunc_group_last(void *ctx, struct cargs *cargs)
+{
+   struct screen_ctx   *sc = ctx;
+
+   group_only(ctx, sc->group_last);
+}
+
+void
 kbfunc_group_toggle(void *ctx, struct cargs *cargs)
 {
group_toggle(ctx, cargs->flag);
Index: screen.c
===
RCS file: /home/cvs/xenocara/app/cwm/screen.c,v
retrieving revision 1.97
diff -u -p -r1.97 screen.c
--- screen.c24 Mar 2020 14:47:29 -  1.97
+++ screen.c26 Jan 2022 18:48:19 -
@@ -53,6 +53,7 @@ screen_init(int which)
sc->visual = DefaultVisual(X_Dpy, sc->which);
sc->cycling = 0;
sc->hideall = 0;
+   sc->group_last = 1;
 
conf_screen(sc);
 



Re: cwm: add group-last command [Was: Re: cwm: add last-group command]

2021-10-11 Thread Omar Polo


Tom Murphy  writes:

> Tom Murphy wrote:
>> Hi,
>> 
>>   Here's an updated diff from Omar Polo's addition of group-last
>>   command to cwm. I've been using it without issues and it's
>>   really handy to be able to switch back to the previous
>>   workspace you were on with it.
>> 
>>   Many thanks to Omar Polo for doing all the original work. I've
>>   just updated the diff so it applies cleanly.

Thanks for reviving the patch.

I've kept using it this whole time and still found it super useful!

>>   OK?
>> 
>>   Tom
>> 
>> [...]
>
> I discovered something strange while testing this. 
> X Windows appears to bug out and ends up showing one
> of the windows across all groups until cwm is reloaded.
>
> To reproduce:
>
> 1. Bind group-last to any key you like (I used 4-Tab)
> 2. Open up a window in group 1
> 3. Switch to group 2 and open up a different window there
> 4. Switch back to group 1
> 5. Jam on the 4-Tab key (or whatever you bound in step 1)
> 6. After a while the windows flicker and then you get one
>of the windows stuck as sticky.
> 7. $HOME/.xsession-errors contains error messages like these:
>
> [ 10/10/21 22:29:12.946 x_create_picture_with_pictfmt_and_pixmap ERROR ]
>  failed to create picture (X error 9 DRAWABLE request 139 minor 4 serial 4284)
> [ 10/10/21 22:29:12.962 paint_one ERROR ] Window 0x006c is missing
>  painting data.
> [ 10/10/21 22:29:13.079 x_create_picture_with_pictfmt_and_pixmap ERROR ]
>  failed to create picture (X error 9 DRAWABLE request 139 minor 4 serial 4501)
> [ 10/10/21 22:29:13.094 paint_one ERROR ] Window 0x006c is missing
>  painting data.
> (etc... with different numbers after 'serial')
>
> I wonder if I triggered some X Windows bug by not using this function
> as intended? (toggling it over and over would not be normal use)
>
> It does work on normal desktop usage, as most people won't be trying
> to break it like this.
>
> Any ideas? Seems strange behavior to me.

I think it has happened in the past to me too, but I can't always
reproduce it (even if I hold 4-Tab for half a minute, sometime it
doesn't get stuck.)  I've been using this patch for a long time, so I
don't know if it's something that happened also with an unpatched cwm.

Just one small clarification to your description: (point 6) a window can
get "sticky", but not in the usual cwm sense.  A stuck window is not
able to get focus, if you click on it you get the usual cwm menu as if
the window wasn't there, and you can't focus or resize it or anything
else.  But after a restart, it's "live" again.

I also don't think the error messages you posted are generated by cwm.
I've managed to reproduce it once in the current session and I don't
have anything like that in .xsession-errors.  (I don't have anything
that resembles a cwm error either in .xsession-errors, and I'm running
cwm -vvv)

Excluding the common debug3: xev_handle_{enternotify,propertynotify,...}
all that remains are a couple of

error 8: BadMatch (invalid parameter attributes) request 142 minor 6 serial 
163124
error 9: BadDrawable (invalid Pixmap or Window parameter) request 139 minor 4 
serial 163125
error 4: BadPixmap (invalid Pixmap parameter) request 54 minor 0 serial 163325

that don't seem to be logged by cwm and neither to be related to the
error (they are logged both long before and after the accident.)

> Thanks,
> Tom



Re: cwm: add group-last command [Was: Re: cwm: add last-group command]

2021-10-10 Thread Tom Murphy
Tom Murphy wrote:
> Hi,
> 
>   Here's an updated diff from Omar Polo's addition of group-last
>   command to cwm. I've been using it without issues and it's
>   really handy to be able to switch back to the previous
>   workspace you were on with it.
> 
>   Many thanks to Omar Polo for doing all the original work. I've
>   just updated the diff so it applies cleanly.
> 
>   OK?
> 
>   Tom
> 
> 
> Index: calmwm.h
> ===
> RCS file: /cvs/xenocara/app/cwm/calmwm.h,v
> retrieving revision 1.375
> diff -u -p -r1.375 calmwm.h
> --- calmwm.h  16 Apr 2020 13:32:35 -  1.375
> +++ calmwm.h  10 Oct 2021 19:13:41 -
> @@ -214,6 +214,7 @@ struct screen_ctx {
>   struct region_q  regionq;
>   struct group_q   groupq;
>   struct group_ctx*group_active;
> + int  group_last;
>   Colormap colormap;
>   Visual  *visual;
>   struct {
> @@ -501,6 +502,7 @@ void   
> kbfunc_client_toggle_group(void 
>  void  kbfunc_client_movetogroup(void *, struct cargs *);
>  void  kbfunc_group_toggle(void *, struct cargs *);
>  void  kbfunc_group_only(void *, struct cargs *);
> +void  kbfunc_group_last(void *, struct cargs *);
>  void  kbfunc_group_close(void *, struct cargs *);
>  void  kbfunc_group_cycle(void *, struct cargs *);
>  void  kbfunc_group_toggle_all(void *, struct cargs *);
> Index: conf.c
> ===
> RCS file: /cvs/xenocara/app/cwm/conf.c,v
> retrieving revision 1.252
> diff -u -p -r1.252 conf.c
> --- conf.c16 Apr 2020 13:32:35 -  1.252
> +++ conf.c10 Oct 2021 19:13:41 -
> @@ -139,6 +139,7 @@ static const struct {
>  
>   { FUNC_SC(group-cycle, group_cycle, (CWM_CYCLE_FORWARD)) },
>   { FUNC_SC(group-rcycle, group_cycle, (CWM_CYCLE_REVERSE)) },
> + { FUNC_SC(group-last, group_last, 0) },
>   { FUNC_SC(group-toggle-all, group_toggle_all, 0) },
>   { FUNC_SC(group-toggle-1, group_toggle, 1) },
>   { FUNC_SC(group-toggle-2, group_toggle, 2) },
> Index: cwmrc.5
> ===
> RCS file: /cvs/xenocara/app/cwm/cwmrc.5,v
> retrieving revision 1.76
> diff -u -p -r1.76 cwmrc.5
> --- cwmrc.5   16 Apr 2020 13:32:35 -  1.76
> +++ cwmrc.5   10 Oct 2021 19:13:41 -
> @@ -273,6 +273,8 @@ menu.
>  Toggle visibility of group n, where n is 1-9.
>  .It group-only-[n]
>  Show only group n, where n is 1-9, hiding other groups.
> +.It group-last
> +Show only the last viewed group.
>  .It group-close-[n]
>  Close all windows in group n, where n is 1-9.
>  .It group-toggle-all
> Index: group.c
> ===
> RCS file: /cvs/xenocara/app/cwm/group.c,v
> retrieving revision 1.137
> diff -u -p -r1.137 group.c
> --- group.c   27 Feb 2020 14:56:39 -  1.137
> +++ group.c   10 Oct 2021 19:13:41 -
> @@ -215,6 +215,9 @@ group_only(struct screen_ctx *sc, int id
>  {
>   struct group_ctx*gc;
>  
> + if (sc->group_active->num != idx)
> + sc->group_last = sc->group_active->num;
> +
>   TAILQ_FOREACH(gc, >groupq, entry) {
>   if (gc->num == idx)
>   group_show(gc);
> Index: kbfunc.c
> ===
> RCS file: /cvs/xenocara/app/cwm/kbfunc.c,v
> retrieving revision 1.170
> diff -u -p -r1.170 kbfunc.c
> --- kbfunc.c  20 Mar 2020 18:50:08 -  1.170
> +++ kbfunc.c  10 Oct 2021 19:13:41 -
> @@ -479,6 +479,14 @@ kbfunc_group_only(void *ctx, struct carg
>  }
>  
>  void
> +kbfunc_group_last(void *ctx, struct cargs *cargs)
> +{
> + struct screen_ctx   *sc = ctx;
> +
> + group_only(ctx, sc->group_last);
> +}
> +
> +void
>  kbfunc_group_toggle(void *ctx, struct cargs *cargs)
>  {
>   group_toggle(ctx, cargs->flag);
> Index: screen.c
> ===
> RCS file: /cvs/xenocara/app/cwm/screen.c,v
> retrieving revision 1.97
> diff -u -p -r1.97 screen.c
> --- screen.c  24 Mar 2020 14:47:29 -  1.97
> +++ screen.c  10 Oct 2021 19:13:41 -
> @@ -53,6 +53,7 @@ screen_init(int which)
>   sc->visual = DefaultVisual(X_Dpy, sc->which);
>   sc->cycling = 0;
>   sc->hideall = 0;
> + sc->group_last = 1;
>  
>   conf_screen(sc);


I discovered something strange while testing this. 
X Windows appears to bug out and ends up showing one
of the windows across all groups until cwm is reloaded.

To reproduce:

1. Bind group-last to any key you like (I used 4-Tab)
2. Open up a window in group 1
3. Switch to group 2 and open up a different window there
4. Switch back to group 1
5. Jam on the 4-Tab key (or whatever you bound in step 1)

Re: cwm: add group-last command [Was: Re: cwm: add last-group command]

2021-10-10 Thread Tom Murphy
Hi,

  Here's an updated diff from Omar Polo's addition of group-last
  command to cwm. I've been using it without issues and it's
  really handy to be able to switch back to the previous
  workspace you were on with it.

  Many thanks to Omar Polo for doing all the original work. I've
  just updated the diff so it applies cleanly.

  OK?

  Tom


Index: calmwm.h
===
RCS file: /cvs/xenocara/app/cwm/calmwm.h,v
retrieving revision 1.375
diff -u -p -r1.375 calmwm.h
--- calmwm.h16 Apr 2020 13:32:35 -  1.375
+++ calmwm.h10 Oct 2021 19:13:41 -
@@ -214,6 +214,7 @@ struct screen_ctx {
struct region_q  regionq;
struct group_q   groupq;
struct group_ctx*group_active;
+   int  group_last;
Colormap colormap;
Visual  *visual;
struct {
@@ -501,6 +502,7 @@ void 
kbfunc_client_toggle_group(void 
 voidkbfunc_client_movetogroup(void *, struct cargs *);
 voidkbfunc_group_toggle(void *, struct cargs *);
 voidkbfunc_group_only(void *, struct cargs *);
+voidkbfunc_group_last(void *, struct cargs *);
 voidkbfunc_group_close(void *, struct cargs *);
 voidkbfunc_group_cycle(void *, struct cargs *);
 voidkbfunc_group_toggle_all(void *, struct cargs *);
Index: conf.c
===
RCS file: /cvs/xenocara/app/cwm/conf.c,v
retrieving revision 1.252
diff -u -p -r1.252 conf.c
--- conf.c  16 Apr 2020 13:32:35 -  1.252
+++ conf.c  10 Oct 2021 19:13:41 -
@@ -139,6 +139,7 @@ static const struct {
 
{ FUNC_SC(group-cycle, group_cycle, (CWM_CYCLE_FORWARD)) },
{ FUNC_SC(group-rcycle, group_cycle, (CWM_CYCLE_REVERSE)) },
+   { FUNC_SC(group-last, group_last, 0) },
{ FUNC_SC(group-toggle-all, group_toggle_all, 0) },
{ FUNC_SC(group-toggle-1, group_toggle, 1) },
{ FUNC_SC(group-toggle-2, group_toggle, 2) },
Index: cwmrc.5
===
RCS file: /cvs/xenocara/app/cwm/cwmrc.5,v
retrieving revision 1.76
diff -u -p -r1.76 cwmrc.5
--- cwmrc.5 16 Apr 2020 13:32:35 -  1.76
+++ cwmrc.5 10 Oct 2021 19:13:41 -
@@ -273,6 +273,8 @@ menu.
 Toggle visibility of group n, where n is 1-9.
 .It group-only-[n]
 Show only group n, where n is 1-9, hiding other groups.
+.It group-last
+Show only the last viewed group.
 .It group-close-[n]
 Close all windows in group n, where n is 1-9.
 .It group-toggle-all
Index: group.c
===
RCS file: /cvs/xenocara/app/cwm/group.c,v
retrieving revision 1.137
diff -u -p -r1.137 group.c
--- group.c 27 Feb 2020 14:56:39 -  1.137
+++ group.c 10 Oct 2021 19:13:41 -
@@ -215,6 +215,9 @@ group_only(struct screen_ctx *sc, int id
 {
struct group_ctx*gc;
 
+   if (sc->group_active->num != idx)
+   sc->group_last = sc->group_active->num;
+
TAILQ_FOREACH(gc, >groupq, entry) {
if (gc->num == idx)
group_show(gc);
Index: kbfunc.c
===
RCS file: /cvs/xenocara/app/cwm/kbfunc.c,v
retrieving revision 1.170
diff -u -p -r1.170 kbfunc.c
--- kbfunc.c20 Mar 2020 18:50:08 -  1.170
+++ kbfunc.c10 Oct 2021 19:13:41 -
@@ -479,6 +479,14 @@ kbfunc_group_only(void *ctx, struct carg
 }
 
 void
+kbfunc_group_last(void *ctx, struct cargs *cargs)
+{
+   struct screen_ctx   *sc = ctx;
+
+   group_only(ctx, sc->group_last);
+}
+
+void
 kbfunc_group_toggle(void *ctx, struct cargs *cargs)
 {
group_toggle(ctx, cargs->flag);
Index: screen.c
===
RCS file: /cvs/xenocara/app/cwm/screen.c,v
retrieving revision 1.97
diff -u -p -r1.97 screen.c
--- screen.c24 Mar 2020 14:47:29 -  1.97
+++ screen.c10 Oct 2021 19:13:41 -
@@ -53,6 +53,7 @@ screen_init(int which)
sc->visual = DefaultVisual(X_Dpy, sc->which);
sc->cycling = 0;
sc->hideall = 0;
+   sc->group_last = 1;
 
conf_screen(sc);
 



Re: cwm: add group-last command [Was: Re: cwm: add last-group command]

2021-04-03 Thread Omar Polo


Raf Czlonka  writes:

> On Sat, Apr 03, 2021 at 05:50:06PM BST, Omar Polo wrote:
>> Omar Polo  writes:
>> 
>> > Hello tech@,
>
> Hi Omar,
>
>> > The attached patch adds a last-group command for cwm.  Admittedly,
>> 
>> (typo: it's group-last!  I mistyped that in the subject too, sorry)
>
> Given that 'group_*' and not '*_group' is used in the code, shouldn't
> 'last_group' be renamed to 'group_last' for consistency?

absolutely!

> Regards,
>
> Raf
>
> [...]

Thanks,

Omar Polo

Index: calmwm.h
===
RCS file: /home/cvs/xenocara/app/cwm/calmwm.h,v
retrieving revision 1.375
diff -u -p -r1.375 calmwm.h
--- calmwm.h16 Apr 2020 13:32:35 -  1.375
+++ calmwm.h3 Apr 2021 17:35:05 -
@@ -214,6 +214,7 @@ struct screen_ctx {
struct region_q  regionq;
struct group_q   groupq;
struct group_ctx*group_active;
+   int  group_last;
Colormap colormap;
Visual  *visual;
struct {
@@ -501,6 +502,7 @@ void 
kbfunc_client_toggle_group(void 
 voidkbfunc_client_movetogroup(void *, struct cargs *);
 voidkbfunc_group_toggle(void *, struct cargs *);
 voidkbfunc_group_only(void *, struct cargs *);
+voidkbfunc_group_last(void *, struct cargs *);
 voidkbfunc_group_close(void *, struct cargs *);
 voidkbfunc_group_cycle(void *, struct cargs *);
 voidkbfunc_group_toggle_all(void *, struct cargs *);
Index: conf.c
===
RCS file: /home/cvs/xenocara/app/cwm/conf.c,v
retrieving revision 1.252
diff -u -p -r1.252 conf.c
--- conf.c  16 Apr 2020 13:32:35 -  1.252
+++ conf.c  26 Aug 2020 12:29:53 -
@@ -139,6 +139,7 @@ static const struct {
 
{ FUNC_SC(group-cycle, group_cycle, (CWM_CYCLE_FORWARD)) },
{ FUNC_SC(group-rcycle, group_cycle, (CWM_CYCLE_REVERSE)) },
+   { FUNC_SC(group-last, group_last, 0) },
{ FUNC_SC(group-toggle-all, group_toggle_all, 0) },
{ FUNC_SC(group-toggle-1, group_toggle, 1) },
{ FUNC_SC(group-toggle-2, group_toggle, 2) },
Index: cwmrc.5
===
RCS file: /home/cvs/xenocara/app/cwm/cwmrc.5,v
retrieving revision 1.76
diff -u -p -r1.76 cwmrc.5
--- cwmrc.5 16 Apr 2020 13:32:35 -  1.76
+++ cwmrc.5 3 Apr 2021 16:39:17 -
@@ -273,6 +273,8 @@ menu.
 Toggle visibility of group n, where n is 1-9.
 .It group-only-[n]
 Show only group n, where n is 1-9, hiding other groups.
+.It group-last
+Show only the last viewed group.
 .It group-close-[n]
 Close all windows in group n, where n is 1-9.
 .It group-toggle-all
Index: group.c
===
RCS file: /home/cvs/xenocara/app/cwm/group.c,v
retrieving revision 1.137
diff -u -p -r1.137 group.c
--- group.c 27 Feb 2020 14:56:39 -  1.137
+++ group.c 3 Apr 2021 17:35:05 -
@@ -215,6 +215,9 @@ group_only(struct screen_ctx *sc, int id
 {
struct group_ctx*gc;
 
+   if (sc->group_active->num != idx)
+   sc->group_last = sc->group_active->num;
+
TAILQ_FOREACH(gc, >groupq, entry) {
if (gc->num == idx)
group_show(gc);
Index: kbfunc.c
===
RCS file: /home/cvs/xenocara/app/cwm/kbfunc.c,v
retrieving revision 1.170
diff -u -p -r1.170 kbfunc.c
--- kbfunc.c20 Mar 2020 18:50:08 -  1.170
+++ kbfunc.c3 Apr 2021 17:35:04 -
@@ -479,6 +479,14 @@ kbfunc_group_only(void *ctx, struct carg
 }
 
 void
+kbfunc_group_last(void *ctx, struct cargs *cargs)
+{
+   struct screen_ctx   *sc = ctx;
+
+   group_only(ctx, sc->group_last);
+}
+
+void
 kbfunc_group_toggle(void *ctx, struct cargs *cargs)
 {
group_toggle(ctx, cargs->flag);
Index: screen.c
===
RCS file: /home/cvs/xenocara/app/cwm/screen.c,v
retrieving revision 1.97
diff -u -p -r1.97 screen.c
--- screen.c24 Mar 2020 14:47:29 -  1.97
+++ screen.c3 Apr 2021 17:34:55 -
@@ -53,6 +53,7 @@ screen_init(int which)
sc->visual = DefaultVisual(X_Dpy, sc->which);
sc->cycling = 0;
sc->hideall = 0;
+   sc->group_last = 1;
 
conf_screen(sc);
 



Re: cwm: add group-last command [Was: Re: cwm: add last-group command]

2021-04-03 Thread Raf Czlonka
On Sat, Apr 03, 2021 at 05:50:06PM BST, Omar Polo wrote:
> Omar Polo  writes:
> 
> > Hello tech@,

Hi Omar,

> > The attached patch adds a last-group command for cwm.  Admittedly,
> 
> (typo: it's group-last!  I mistyped that in the subject too, sorry)

Given that 'group_*' and not '*_group' is used in the code, shouldn't
'last_group' be renamed to 'group_last' for consistency?

Regards,

Raf

> > last-group probably makes sense only in sticky group mode; all it does
> > is switching to the last group.
> >
> > I've been happily using this since last summer, I'm quite confident it's
> > not 100% broken.
> >
> > I haven't added a default keybinding, so to test you have to add
> > something like this to your .cwmrc
> >
> > bind-key 4-Tab group-last
> >
> > Cheers!
> >
> > Omar Polo
> 
> ping.
> 
> I'm not too attached to this patch however, so I can keep it in my tree =)
> 
> Patch re-attached for convenience (and with a missing dot in the manpage
> description of the group-last command.)
> 
> Index: calmwm.h
> ===
> RCS file: /home/cvs/xenocara/app/cwm/calmwm.h,v
> retrieving revision 1.375
> diff -u -p -r1.375 calmwm.h
> --- calmwm.h  16 Apr 2020 13:32:35 -  1.375
> +++ calmwm.h  26 Aug 2020 12:18:50 -
> @@ -214,6 +214,7 @@ struct screen_ctx {
>   struct region_q  regionq;
>   struct group_q   groupq;
>   struct group_ctx*group_active;
> + int  last_group;
 ^^
Here.

>   Colormap colormap;
>   Visual  *visual;
>   struct {
> @@ -501,6 +502,7 @@ void   
> kbfunc_client_toggle_group(void 
>  void  kbfunc_client_movetogroup(void *, struct cargs *);
>  void  kbfunc_group_toggle(void *, struct cargs *);
>  void  kbfunc_group_only(void *, struct cargs *);
> +void  kbfunc_group_last(void *, struct cargs *);
>  void  kbfunc_group_close(void *, struct cargs *);
>  void  kbfunc_group_cycle(void *, struct cargs *);
>  void  kbfunc_group_toggle_all(void *, struct cargs *);
> Index: conf.c
> ===
> RCS file: /home/cvs/xenocara/app/cwm/conf.c,v
> retrieving revision 1.252
> diff -u -p -r1.252 conf.c
> --- conf.c16 Apr 2020 13:32:35 -  1.252
> +++ conf.c26 Aug 2020 12:29:53 -
> @@ -139,6 +139,7 @@ static const struct {
>  
>   { FUNC_SC(group-cycle, group_cycle, (CWM_CYCLE_FORWARD)) },
>   { FUNC_SC(group-rcycle, group_cycle, (CWM_CYCLE_REVERSE)) },
> + { FUNC_SC(group-last, group_last, 0) },
>   { FUNC_SC(group-toggle-all, group_toggle_all, 0) },
>   { FUNC_SC(group-toggle-1, group_toggle, 1) },
>   { FUNC_SC(group-toggle-2, group_toggle, 2) },
> Index: cwmrc.5
> ===
> RCS file: /home/cvs/xenocara/app/cwm/cwmrc.5,v
> retrieving revision 1.76
> diff -u -p -r1.76 cwmrc.5
> --- cwmrc.5   16 Apr 2020 13:32:35 -  1.76
> +++ cwmrc.5   3 Apr 2021 16:39:17 -
> @@ -273,6 +273,8 @@ menu.
>  Toggle visibility of group n, where n is 1-9.
>  .It group-only-[n]
>  Show only group n, where n is 1-9, hiding other groups.
> +.It group-last
> +Show only the last viewed group.
>  .It group-close-[n]
>  Close all windows in group n, where n is 1-9.
>  .It group-toggle-all
> Index: group.c
> ===
> RCS file: /home/cvs/xenocara/app/cwm/group.c,v
> retrieving revision 1.137
> diff -u -p -r1.137 group.c
> --- group.c   27 Feb 2020 14:56:39 -  1.137
> +++ group.c   30 Aug 2020 17:01:11 -
> @@ -215,6 +215,9 @@ group_only(struct screen_ctx *sc, int id
>  {
>   struct group_ctx*gc;
>  
> + if (sc->group_active->num != idx)
> + sc->last_group = sc->group_active->num;
^^
Here.

> +
>   TAILQ_FOREACH(gc, >groupq, entry) {
>   if (gc->num == idx)
>   group_show(gc);
> Index: kbfunc.c
> ===
> RCS file: /home/cvs/xenocara/app/cwm/kbfunc.c,v
> retrieving revision 1.170
> diff -u -p -r1.170 kbfunc.c
> --- kbfunc.c  20 Mar 2020 18:50:08 -  1.170
> +++ kbfunc.c  28 Aug 2020 06:45:50 -
> @@ -479,6 +479,14 @@ kbfunc_group_only(void *ctx, struct carg
>  }
>  
>  void
> +kbfunc_group_last(void *ctx, struct cargs *cargs)
> +{
> + struct screen_ctx   *sc = ctx;
> +
> + group_only(ctx, sc->last_group);
^^
Here.

> +}
> +
> +void
>  kbfunc_group_toggle(void *ctx, struct cargs *cargs)
>  {
>   group_toggle(ctx, cargs->flag);
> Index: screen.c
> ===
> RCS file: