diff options
author | Okan Demirmen <okan@cvs.openbsd.org> | 2023-07-20 14:39:35 +0000 |
---|---|---|
committer | Okan Demirmen <okan@cvs.openbsd.org> | 2023-07-20 14:39:35 +0000 |
commit | 566b088f7894100714d9dc581d18590f8db004fc (patch) | |
tree | 880e178067226e4388d8276a222b8daf079faea4 /app | |
parent | 1a651e88cc8ffc251cd14a6c4387735141a904ee (diff) |
Allow cwm(1) to cycle through windows of the same window class as the
active window; default key binding to M-grave, respectively Alt-Tilde,
like other window managers have as well.
from Simon Dassow
Diffstat (limited to 'app')
-rw-r--r-- | app/cwm/calmwm.h | 3 | ||||
-rw-r--r-- | app/cwm/conf.c | 8 | ||||
-rw-r--r-- | app/cwm/cwm.1 | 8 | ||||
-rw-r--r-- | app/cwm/cwmrc.5 | 8 | ||||
-rw-r--r-- | app/cwm/kbfunc.c | 6 |
5 files changed, 25 insertions, 8 deletions
diff --git a/app/cwm/calmwm.h b/app/cwm/calmwm.h index 832fafb11..d27388f20 100644 --- a/app/cwm/calmwm.h +++ b/app/cwm/calmwm.h @@ -15,7 +15,7 @@ * ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF * OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. * - * $OpenBSD: calmwm.h,v 1.378 2022/02/26 15:19:18 okan Exp $ + * $OpenBSD: calmwm.h,v 1.379 2023/07/20 14:39:34 okan Exp $ */ #ifndef _CALMWM_H_ @@ -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, diff --git a/app/cwm/conf.c b/app/cwm/conf.c index 6459aa18f..87a9924b0 100644 --- a/app/cwm/conf.c +++ b/app/cwm/conf.c @@ -15,7 +15,7 @@ * ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF * OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. * - * $OpenBSD: conf.c,v 1.255 2022/02/26 15:19:18 okan Exp $ + * $OpenBSD: conf.c,v 1.256 2023/07/20 14:39:34 okan Exp $ */ #include <sys/types.h> @@ -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" }, diff --git a/app/cwm/cwm.1 b/app/cwm/cwm.1 index fc8f0ece6..107e0b4fe 100644 --- a/app/cwm/cwm.1 +++ b/app/cwm/cwm.1 @@ -1,4 +1,4 @@ -.\" $OpenBSD: cwm.1,v 1.65 2019/07/09 21:38:44 kn Exp $ +.\" $OpenBSD: cwm.1,v 1.66 2023/07/20 14:39:34 okan Exp $ .\" .\" Copyright (c) 2004,2005 Marius Aamodt Eriksen <marius@monkey.org> .\" @@ -14,7 +14,7 @@ .\" ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF .\" OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. .\" -.Dd $Mdocdate: July 9 2019 $ +.Dd $Mdocdate: July 20 2023 $ .Dt CWM 1 .Os .Sh NAME @@ -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] diff --git a/app/cwm/cwmrc.5 b/app/cwm/cwmrc.5 index 0126c3d79..1fef65620 100644 --- a/app/cwm/cwmrc.5 +++ b/app/cwm/cwmrc.5 @@ -1,4 +1,4 @@ -.\" $OpenBSD: cwmrc.5,v 1.77 2022/01/27 18:45:10 op Exp $ +.\" $OpenBSD: cwmrc.5,v 1.78 2023/07/20 14:39:34 okan Exp $ .\" .\" Copyright (c) 2004,2005 Marius Aamodt Eriksen <marius@monkey.org> .\" @@ -14,7 +14,7 @@ .\" ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF .\" OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. .\" -.Dd $Mdocdate: January 27 2022 $ +.Dd $Mdocdate: July 20 2023 $ .Dt CWMRC 5 .Os .Sh NAME @@ -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 diff --git a/app/cwm/kbfunc.c b/app/cwm/kbfunc.c index 6cc4a6fe3..cbfa799c5 100644 --- a/app/cwm/kbfunc.c +++ b/app/cwm/kbfunc.c @@ -15,7 +15,7 @@ * ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF * OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. * - * $OpenBSD: kbfunc.c,v 1.173 2022/02/27 14:59:55 okan Exp $ + * $OpenBSD: kbfunc.c,v 1.174 2023/07/20 14:39:34 okan Exp $ */ #include <sys/types.h> @@ -430,7 +430,9 @@ kbfunc_client_cycle(void *ctx, struct cargs *cargs) /* 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? */ |