diff options
author | okan <okan> | 2014-09-01 18:04:58 +0000 |
---|---|---|
committer | okan <okan> | 2014-09-01 18:04:58 +0000 |
commit | becc7f260c1230def154a98b8f80829d466aa18c (patch) | |
tree | 58a1e36360065a0c37a7bb58e9de3285868df573 /mousefunc.c | |
parent | 3b99d5357667095b3b89e2c41c2cb17d07537b42 (diff) | |
download | cwm-becc7f260c1230def154a98b8f80829d466aa18c.tar.gz cwm-becc7f260c1230def154a98b8f80829d466aa18c.tar.xz cwm-becc7f260c1230def154a98b8f80829d466aa18c.zip |
Merge group_menu into mousefunc_menu_group.
Diffstat (limited to 'mousefunc.c')
-rw-r--r-- | mousefunc.c | 26 |
1 files changed, 25 insertions, 1 deletions
diff --git a/mousefunc.c b/mousefunc.c index 295d3a1..ef96cb3 100644 --- a/mousefunc.c +++ b/mousefunc.c @@ -181,7 +181,31 @@ mousefunc_client_grouptoggle(struct client_ctx *cc, union arg *arg) void mousefunc_menu_group(struct client_ctx *cc, union arg *arg) { - group_menu(cc->sc); + 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 (TAILQ_EMPTY(&gc->clients)) + continue; + menuq_add(&menuq, gc, + group_hidden_state(gc) ? "%d: [%s]" : "%d: %s", + gc->num, sc->group_names[gc->num]); + } + + if (TAILQ_EMPTY(&menuq)) + return; + + mi = menu_filter(sc, &menuq, NULL, NULL, 0, NULL, NULL); + if (mi != NULL && mi->ctx != NULL) { + gc = (struct group_ctx *)mi->ctx; + (group_hidden_state(gc)) ? + group_show(sc, gc) : group_hide(sc, gc); + } + + menuq_clear(&menuq); } void |