Hi folks,
Here's a patch I've been dragging around for years now that allows cwm
to cycle through windows of the same window class as the current one.
Man page parts included, and a default key binding to M-grave,
respectively Alt-Tilde, like other window managers have as well.
Who likes it?
Cheers,
Simon
P.S.: As I'm still inactive, please feel free to take the commit.
Index: calmwm.h
===================================================================
RCS file: /cvs/xenocara/app/cwm/calmwm.h,v
retrieving revision 1.378
diff -u -p -r1.378 calmwm.h
--- calmwm.h 26 Feb 2022 15:19:18 -0000 1.378
+++ calmwm.h 14 Jul 2023 20:12:40 -0000
@@ -67,6 +67,7 @@
#define CWM_CYCLE_FORWARD 0x0001
#define CWM_CYCLE_REVERSE 0x0002
#define CWM_CYCLE_INGROUP 0x0004
+#define CWM_CYCLE_INCLASS 0x0008
enum cwm_status {
CWM_QUIT,
Index: conf.c
===================================================================
RCS file: /cvs/xenocara/app/cwm/conf.c,v
retrieving revision 1.255
diff -u -p -r1.255 conf.c
--- conf.c 26 Feb 2022 15:19:18 -0000 1.255
+++ conf.c 14 Jul 2023 20:12:40 -0000
@@ -136,6 +136,10 @@ static const struct {
(CWM_CYCLE_FORWARD | CWM_CYCLE_INGROUP)) },
{ FUNC_SC(window-rcycle-ingroup, client_cycle,
(CWM_CYCLE_REVERSE | CWM_CYCLE_INGROUP)) },
+ { FUNC_SC(window-cycle-inclass, client_cycle,
+ (CWM_CYCLE_FORWARD | CWM_CYCLE_INCLASS)) },
+ { FUNC_SC(window-rcycle-inclass, client_cycle,
+ (CWM_CYCLE_REVERSE | CWM_CYCLE_INCLASS)) },
{ FUNC_SC(group-cycle, group_cycle, (CWM_CYCLE_FORWARD)) },
{ FUNC_SC(group-rcycle, group_cycle, (CWM_CYCLE_REVERSE)) },
@@ -220,6 +224,8 @@ static const struct {
{ "C-slash", "menu-cmd" },
{ "M-Tab", "window-cycle" },
{ "MS-Tab", "window-rcycle" },
+ { "M-grave", "window-cycle-inclass" },
+ { "MS-grave", "window-rcycle-inclass" },
{ "CM-n", "window-menu-label" },
{ "CM-x", "window-close" },
{ "CM-a", "group-toggle-all" },
Index: cwm.1
===================================================================
RCS file: /cvs/xenocara/app/cwm/cwm.1,v
retrieving revision 1.65
diff -u -p -r1.65 cwm.1
--- cwm.1 9 Jul 2019 21:38:44 -0000 1.65
+++ cwm.1 14 Jul 2023 20:12:40 -0000
@@ -102,6 +102,10 @@ Label current window.
Cycle through currently visible windows.
.It Ic MS-Tab
Reverse cycle through currently visible windows.
+.It Ic M-grave
+Cycle through currently visible windows of the same window class.
+.It Ic MS-grave
+Reverse cycle through currently visible windows of the same window class.
.It Ic CM-x
Close current window.
.It Ic CM-[n]
Index: cwmrc.5
===================================================================
RCS file: /cvs/xenocara/app/cwm/cwmrc.5,v
retrieving revision 1.77
diff -u -p -r1.77 cwmrc.5
--- cwmrc.5 27 Jan 2022 18:45:10 -0000 1.77
+++ cwmrc.5 14 Jul 2023 20:12:40 -0000
@@ -295,6 +295,10 @@ Reverse cycle through windows.
Forward cycle through windows in current group.
.It window-rcycle-ingroup
Reverse cycle through windows in current group.
+.It window-cycle-inclass
+Forward cycle through windows of the current window class.
+.It window-rcycle-inclass
+Reverse cycle through windows of the current window class.
.It window-close
Close current window.
.It window-hide
Index: kbfunc.c
===================================================================
RCS file: /cvs/xenocara/app/cwm/kbfunc.c,v
retrieving revision 1.173
diff -u -p -r1.173 kbfunc.c
--- kbfunc.c 27 Feb 2022 14:59:55 -0000 1.173
+++ kbfunc.c 14 Jul 2023 20:12:40 -0000
@@ -430,7 +430,9 @@ kbfunc_client_cycle(void *ctx, struct ca
/* Only cycle visible and non-ignored windows. */
if ((newcc->flags & (CLIENT_SKIP_CYCLE)) ||
((flags & CWM_CYCLE_INGROUP) &&
- (newcc->gc != oldcc->gc)))
+ (newcc->gc != oldcc->gc)) ||
+ ((flags & CWM_CYCLE_INCLASS) &&
+ strcmp(newcc->res_class, oldcc->res_class) != 0))
again = 1;
/* Is oldcc the only non-hidden window? */