summary refs log tree commit diff
path: root/kbfunc.c
diff options
context:
space:
mode:
authorokan <okan>2015-07-12 14:31:47 +0000
committerokan <okan>2015-07-12 14:31:47 +0000
commit0d13b7c2205bd40d9fd4db016c8cf96f620c4f8d (patch)
tree46098b5872c7c48a45dceeb91eb96244335c496b /kbfunc.c
parent5c2decc8d000098ef682efd21392f7205fac77cf (diff)
downloadcwm-0d13b7c2205bd40d9fd4db016c8cf96f620c4f8d.tar.gz
cwm-0d13b7c2205bd40d9fd4db016c8cf96f620c4f8d.tar.xz
cwm-0d13b7c2205bd40d9fd4db016c8cf96f620c4f8d.zip
introduce 'groupsearch' for group menu search; matches on either group
number/shortcut and/or name.
Diffstat (limited to 'kbfunc.c')
-rw-r--r--kbfunc.c25
1 files changed, 25 insertions, 0 deletions
diff --git a/kbfunc.c b/kbfunc.c
index a107b95..ef4c49a 100644
--- a/kbfunc.c
+++ b/kbfunc.c
@@ -188,6 +188,31 @@ kbfunc_menu_cmd(struct client_ctx *cc, union arg *arg)
 }
 
 void
+kbfunc_menu_group(struct client_ctx *cc, union arg *arg)
+{
+	struct screen_ctx	*sc = cc->sc;
+	struct group_ctx	*gc;
+	struct menu		*mi;
+	struct menu_q		 menuq;
+
+	TAILQ_INIT(&menuq);
+	TAILQ_FOREACH(gc, &sc->groupq, entry) {
+		if (group_holds_only_sticky(gc))
+			continue;
+		menuq_add(&menuq, gc, "%d %s", gc->num, gc->name);
+	}
+
+	if ((mi = menu_filter(sc, &menuq, "group", NULL, CWM_MENU_LIST,
+	    search_match_text, search_print_group)) != NULL) {
+		gc = (struct group_ctx *)mi->ctx;
+		(group_holds_only_hidden(gc)) ?
+		    group_show(gc) : group_hide(gc);
+	}
+
+	menuq_clear(&menuq);
+}
+
+void
 kbfunc_client_cycle(struct client_ctx *cc, union arg *arg)
 {
 	struct screen_ctx	*sc = cc->sc;