summary refs log tree commit diff
path: root/group.c
diff options
context:
space:
mode:
authorokan <okan>2019-02-25 16:40:49 +0000
committerokan <okan>2019-02-25 16:40:49 +0000
commita5ba9aa9da9567244d1c3d1d8ccacfdb51b044de (patch)
treec79190375cd8f32a840bdc7978dfea10a0c65959 /group.c
parent43cd19378ed244f9bd9f86e51bca0f3905055bdf (diff)
downloadcwm-a5ba9aa9da9567244d1c3d1d8ccacfdb51b044de.tar.gz
cwm-a5ba9aa9da9567244d1c3d1d8ccacfdb51b044de.tar.xz
cwm-a5ba9aa9da9567244d1c3d1d8ccacfdb51b044de.zip
Add 'group-close-[n]' action to close all windows within specified group.
heavily based on a diff from Nam Nguyen.
Diffstat (limited to 'group.c')
-rw-r--r--group.c17
1 files changed, 17 insertions, 0 deletions
diff --git a/group.c b/group.c
index 4c25bcc..30fe718 100644
--- a/group.c
+++ b/group.c
@@ -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;