diff options
author | Okan Demirmen <okan@cvs.openbsd.org> | 2011-09-03 09:20:59 +0000 |
---|---|---|
committer | Okan Demirmen <okan@cvs.openbsd.org> | 2011-09-03 09:20:59 +0000 |
commit | 218bb464d527fc38c4350044a45e82a9fa10253d (patch) | |
tree | 0acda6fa629c314047e4eaa63e2d10c46b4bb819 | |
parent | eac840da13497057308fa103338fe3b26bc363c7 (diff) |
Add {r,}cycleingroup to cycle through clients belonging to the same
group as the active client (as opposed to all unhidden clients); from
Alexander Polakov, with a tiny tweak requested by oga.
ok oga@
-rw-r--r-- | app/cwm/calmwm.h | 7 | ||||
-rw-r--r-- | app/cwm/client.c | 11 | ||||
-rw-r--r-- | app/cwm/conf.c | 4 | ||||
-rw-r--r-- | app/cwm/cwmrc.5 | 8 |
4 files changed, 19 insertions, 11 deletions
diff --git a/app/cwm/calmwm.h b/app/cwm/calmwm.h index e9b284a64..5156fa7c0 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.136 2011/09/03 09:17:16 okan Exp $ + * $OpenBSD: calmwm.h,v 1.137 2011/09/03 09:20:58 okan Exp $ */ #ifndef _CALMWM_H_ @@ -68,8 +68,9 @@ #define CWM_EXEC_WM 0x0002 /* cycle */ -#define CWM_CYCLE 0 -#define CWM_RCYCLE 1 +#define CWM_CYCLE 0x0001 +#define CWM_RCYCLE 0x0002 +#define CWM_INGROUP 0x0004 #define KBTOGROUP(X) ((X) - 1) diff --git a/app/cwm/client.c b/app/cwm/client.c index a94633781..6359a3578 100644 --- a/app/cwm/client.c +++ b/app/cwm/client.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: client.c,v 1.86 2011/07/14 11:39:53 okan Exp $ + * $OpenBSD: client.c,v 1.87 2011/09/03 09:20:58 okan Exp $ */ #include <sys/param.h> @@ -567,7 +567,7 @@ match: } void -client_cycle(struct screen_ctx *sc, int reverse) +client_cycle(struct screen_ctx *sc, int flags) { struct client_ctx *oldcc, *newcc; int again = 1; @@ -579,18 +579,19 @@ client_cycle(struct screen_ctx *sc, int reverse) return; if (oldcc == NULL) - oldcc = (reverse ? TAILQ_LAST(&sc->mruq, cycle_entry_q) : + oldcc = (flags & CWM_RCYCLE ? TAILQ_LAST(&sc->mruq, cycle_entry_q) : TAILQ_FIRST(&sc->mruq)); newcc = oldcc; while (again) { again = 0; - newcc = (reverse ? client_mruprev(newcc) : + newcc = (flags & CWM_RCYCLE ? client_mruprev(newcc) : client_mrunext(newcc)); /* Only cycle visible and non-ignored windows. */ - if (newcc->flags & (CLIENT_HIDDEN|CLIENT_IGNORE)) + if ((newcc->flags & (CLIENT_HIDDEN|CLIENT_IGNORE)) + || ((flags & CWM_INGROUP) && (newcc->group != oldcc->group))) again = 1; /* Is oldcc the only non-hidden window? */ diff --git a/app/cwm/conf.c b/app/cwm/conf.c index 656133e61..190470f93 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.92 2011/09/03 09:17:16 okan Exp $ + * $OpenBSD: conf.c,v 1.93 2011/09/03 09:20:58 okan Exp $ */ #include <sys/param.h> @@ -359,6 +359,8 @@ static struct { { "nogroup", kbfunc_client_nogroup, 0, {0} }, { "cyclegroup", kbfunc_client_cyclegroup, 0, {.i = CWM_CYCLE} }, { "rcyclegroup", kbfunc_client_cyclegroup, 0, {.i = CWM_RCYCLE} }, + { "cycleingroup", kbfunc_client_cycle, KBFLAG_NEEDCLIENT, {.i = CWM_CYCLE|CWM_INGROUP} }, + { "rcycleingroup", kbfunc_client_cycle, KBFLAG_NEEDCLIENT, {.i = CWM_RCYCLE|CWM_INGROUP} }, { "grouptoggle", kbfunc_client_grouptoggle, KBFLAG_NEEDCLIENT, {0}}, { "maximize", kbfunc_client_maximize, KBFLAG_NEEDCLIENT, {0} }, { "vmaximize", kbfunc_client_vmaximize, KBFLAG_NEEDCLIENT, {0} }, diff --git a/app/cwm/cwmrc.5 b/app/cwm/cwmrc.5 index f9dd9f595..5443dd5ca 100644 --- a/app/cwm/cwmrc.5 +++ b/app/cwm/cwmrc.5 @@ -1,4 +1,4 @@ -.\" $OpenBSD: cwmrc.5,v 1.38 2011/06/25 13:12:56 okan Exp $ +.\" $OpenBSD: cwmrc.5,v 1.39 2011/09/03 09:20:58 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: June 25 2011 $ +.Dd $Mdocdate: September 3 2011 $ .Dt CWMRC 5 .Os .Sh NAME @@ -289,6 +289,10 @@ Reverse cycle through groups. Forward cycle through windows. .It rcycle Reverse cycle through windows. +.It cycleingroup +Forward cycle through windows in current group. +.It rcycleingroup +Reverse cycle through windows in current group. .It snapdist Minimum distance to snap-to adjacent edge. .It delete |