From b05f7a824f98fee35cc1fd31eae62460a743075c Mon Sep 17 00:00:00 2001 From: okan Date: Sun, 12 Jul 2015 14:31:47 +0000 Subject: introduce 'groupsearch' for group menu search; matches on either group number/shortcut and/or name. --- kbfunc.c | 27 ++++++++++++++++++++++++++- 1 file changed, 26 insertions(+), 1 deletion(-) (limited to 'kbfunc.c') diff --git a/kbfunc.c b/kbfunc.c index d3c54a0..046c898 100644 --- a/kbfunc.c +++ b/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.112 2015/07/03 17:11:16 okan Exp $ + * $OpenBSD: kbfunc.c,v 1.113 2015/07/12 14:31:47 okan Exp $ */ #include @@ -187,6 +187,31 @@ kbfunc_menu_cmd(struct client_ctx *cc, union arg *arg) menuq_clear(&menuq); } +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) { -- cgit v1.2.3-2-gb3c3