diff options
author | Okan Demirmen <okan@cvs.openbsd.org> | 2019-02-25 16:40:50 +0000 |
---|---|---|
committer | Okan Demirmen <okan@cvs.openbsd.org> | 2019-02-25 16:40:50 +0000 |
commit | be8686c9ac0034e83047c57d5270f610f1b202a0 (patch) | |
tree | 92f7b6fbb593d1f5467e48b7e792e41e2a100704 /app/cwm | |
parent | bc481e26e152d14bd0bdd0701dad09b5ce41057e (diff) |
Add 'group-close-[n]' action to close all windows within specified group.
heavily based on a diff from Nam Nguyen.
Diffstat (limited to 'app/cwm')
-rw-r--r-- | app/cwm/calmwm.h | 4 | ||||
-rw-r--r-- | app/cwm/conf.c | 11 | ||||
-rw-r--r-- | app/cwm/cwmrc.5 | 6 | ||||
-rw-r--r-- | app/cwm/group.c | 19 | ||||
-rw-r--r-- | app/cwm/kbfunc.c | 8 |
5 files changed, 42 insertions, 6 deletions
diff --git a/app/cwm/calmwm.h b/app/cwm/calmwm.h index c5521d9b0..aac949d8f 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.363 2019/02/22 19:40:32 okan Exp $ + * $OpenBSD: calmwm.h,v 1.364 2019/02/25 16:40:49 okan Exp $ */ #ifndef _CALMWM_H_ @@ -451,6 +451,7 @@ int group_holds_only_sticky(struct group_ctx *); void group_init(struct screen_ctx *, int); void group_movetogroup(struct client_ctx *, int); void group_only(struct screen_ctx *, int); +void group_close(struct screen_ctx *, int); int group_restore(struct client_ctx *); void group_show(struct group_ctx *); void group_toggle_membership(struct client_ctx *); @@ -508,6 +509,7 @@ void kbfunc_client_toggle_group(void *, struct cargs *); void kbfunc_client_movetogroup(void *, struct cargs *); void kbfunc_group_toggle(void *, struct cargs *); void kbfunc_group_only(void *, struct cargs *); +void kbfunc_group_close(void *, struct cargs *); void kbfunc_group_cycle(void *, struct cargs *); void kbfunc_group_alltoggle(void *, struct cargs *); void kbfunc_menu_client(void *, struct cargs *); diff --git a/app/cwm/conf.c b/app/cwm/conf.c index dde35abaa..2d3f9313a 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.244 2019/02/22 19:40:33 okan Exp $ + * $OpenBSD: conf.c,v 1.245 2019/02/25 16:40:49 okan Exp $ */ #include <sys/types.h> @@ -143,6 +143,15 @@ static const struct { { FUNC_SC(group-only-7, group_only, 7) }, { FUNC_SC(group-only-8, group_only, 8) }, { FUNC_SC(group-only-9, group_only, 9) }, + { FUNC_SC(group-close-1, group_close, 1) }, + { FUNC_SC(group-close-2, group_close, 2) }, + { FUNC_SC(group-close-3, group_close, 3) }, + { FUNC_SC(group-close-4, group_close, 4) }, + { FUNC_SC(group-close-5, group_close, 5) }, + { FUNC_SC(group-close-6, group_close, 6) }, + { FUNC_SC(group-close-7, group_close, 7) }, + { FUNC_SC(group-close-8, group_close, 8) }, + { FUNC_SC(group-close-9, group_close, 9) }, { FUNC_SC(pointer-move-up, ptrmove, (CWM_UP)) }, { FUNC_SC(pointer-move-down, ptrmove, (CWM_DOWN)) }, diff --git a/app/cwm/cwmrc.5 b/app/cwm/cwmrc.5 index ffcf64f87..0d2e43bb4 100644 --- a/app/cwm/cwmrc.5 +++ b/app/cwm/cwmrc.5 @@ -1,4 +1,4 @@ -.\" $OpenBSD: cwmrc.5,v 1.71 2019/02/22 19:40:33 okan Exp $ +.\" $OpenBSD: cwmrc.5,v 1.72 2019/02/25 16:40:49 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: February 22 2019 $ +.Dd $Mdocdate: February 25 2019 $ .Dt CWMRC 5 .Os .Sh NAME @@ -288,6 +288,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-close-[n] +Close all windows in group n, where n is 1-9. .It group-toggle-all Toggle visibility of all groups. .It window-group diff --git a/app/cwm/group.c b/app/cwm/group.c index 106ee0adb..c07d2d376 100644 --- a/app/cwm/group.c +++ b/app/cwm/group.c @@ -16,7 +16,7 @@ * ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF * OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. * - * $OpenBSD: group.c,v 1.128 2018/01/23 13:48:49 okan Exp $ + * $OpenBSD: group.c,v 1.129 2019/02/25 16:40:49 okan Exp $ */ #include <sys/types.h> @@ -250,6 +250,23 @@ group_only(struct screen_ctx *sc, int idx) } void +group_close(struct screen_ctx *sc, int idx) +{ + struct group_ctx *gc; + struct client_ctx *cc; + + if (idx < 0 || idx >= Conf.ngroups) + return; + + TAILQ_FOREACH(gc, &sc->groupq, entry) { + if (gc->num == idx) { + TAILQ_FOREACH(cc, &gc->clientq, group_entry) + client_close(cc); + } + } +} + +void group_cycle(struct screen_ctx *sc, int flags) { struct group_ctx *newgc, *oldgc, *showgroup = NULL; diff --git a/app/cwm/kbfunc.c b/app/cwm/kbfunc.c index cb6c65d95..699676ecf 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.161 2019/02/22 19:40:33 okan Exp $ + * $OpenBSD: kbfunc.c,v 1.162 2019/02/25 16:40:49 okan Exp $ */ #include <sys/types.h> @@ -441,6 +441,12 @@ kbfunc_group_only(void *ctx, struct cargs *cargs) } void +kbfunc_group_close(void *ctx, struct cargs *cargs) +{ + group_close(ctx, cargs->flag); +} + +void kbfunc_group_cycle(void *ctx, struct cargs *cargs) { group_cycle(ctx, cargs->flag); |