mirror of
https://github.com/leahneukirchen/cwm.git
synced 2023-08-10 21:13:12 +03:00
introduce 'groupsearch' for group menu search; matches on either group
number/shortcut and/or name.
This commit is contained in:
parent
5c2decc8d0
commit
0d13b7c220
2
calmwm.h
2
calmwm.h
@ -450,6 +450,7 @@ void search_match_text(struct menu_q *, struct menu_q *,
|
|||||||
char *);
|
char *);
|
||||||
void search_print_client(struct menu *, int);
|
void search_print_client(struct menu *, int);
|
||||||
void search_print_cmd(struct menu *, int);
|
void search_print_cmd(struct menu *, int);
|
||||||
|
void search_print_group(struct menu *, int);
|
||||||
|
|
||||||
struct geom screen_apply_gap(struct screen_ctx *, struct geom);
|
struct geom screen_apply_gap(struct screen_ctx *, struct geom);
|
||||||
struct screen_ctx *screen_find(Window);
|
struct screen_ctx *screen_find(Window);
|
||||||
@ -496,6 +497,7 @@ void kbfunc_cwm_status(struct client_ctx *, union arg *);
|
|||||||
void kbfunc_exec(struct client_ctx *, union arg *);
|
void kbfunc_exec(struct client_ctx *, union arg *);
|
||||||
void kbfunc_lock(struct client_ctx *, union arg *);
|
void kbfunc_lock(struct client_ctx *, union arg *);
|
||||||
void kbfunc_menu_cmd(struct client_ctx *, union arg *);
|
void kbfunc_menu_cmd(struct client_ctx *, union arg *);
|
||||||
|
void kbfunc_menu_group(struct client_ctx *, union arg *);
|
||||||
void kbfunc_ssh(struct client_ctx *, union arg *);
|
void kbfunc_ssh(struct client_ctx *, union arg *);
|
||||||
void kbfunc_term(struct client_ctx *, union arg *);
|
void kbfunc_term(struct client_ctx *, union arg *);
|
||||||
void kbfunc_tile(struct client_ctx *, union arg *);
|
void kbfunc_tile(struct client_ctx *, union arg *);
|
||||||
|
1
conf.c
1
conf.c
@ -360,6 +360,7 @@ static const struct {
|
|||||||
{ "raise", kbfunc_client_raise, CWM_WIN, {0} },
|
{ "raise", kbfunc_client_raise, CWM_WIN, {0} },
|
||||||
{ "search", kbfunc_client_search, 0, {0} },
|
{ "search", kbfunc_client_search, 0, {0} },
|
||||||
{ "menusearch", kbfunc_menu_cmd, 0, {0} },
|
{ "menusearch", kbfunc_menu_cmd, 0, {0} },
|
||||||
|
{ "groupsearch", kbfunc_menu_group, 0, {0} },
|
||||||
{ "hide", kbfunc_client_hide, CWM_WIN, {0} },
|
{ "hide", kbfunc_client_hide, CWM_WIN, {0} },
|
||||||
{ "cycle", kbfunc_client_cycle, 0, {.i = CWM_CYCLE} },
|
{ "cycle", kbfunc_client_cycle, 0, {.i = CWM_CYCLE} },
|
||||||
{ "rcycle", kbfunc_client_cycle, 0, {.i = CWM_RCYCLE} },
|
{ "rcycle", kbfunc_client_cycle, 0, {.i = CWM_RCYCLE} },
|
||||||
|
2
cwmrc.5
2
cwmrc.5
@ -251,6 +251,8 @@ Lock the screen.
|
|||||||
Launch window search menu.
|
Launch window search menu.
|
||||||
.It menusearch
|
.It menusearch
|
||||||
Launch application search menu.
|
Launch application search menu.
|
||||||
|
.It groupsearch
|
||||||
|
Launch group search menu.
|
||||||
.It exec
|
.It exec
|
||||||
Launch
|
Launch
|
||||||
.Dq exec program
|
.Dq exec program
|
||||||
|
25
kbfunc.c
25
kbfunc.c
@ -187,6 +187,31 @@ kbfunc_menu_cmd(struct client_ctx *cc, union arg *arg)
|
|||||||
menuq_clear(&menuq);
|
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
|
void
|
||||||
kbfunc_client_cycle(struct client_ctx *cc, union arg *arg)
|
kbfunc_client_cycle(struct client_ctx *cc, union arg *arg)
|
||||||
{
|
{
|
||||||
|
@ -182,13 +182,11 @@ mousefunc_menu_group(struct client_ctx *cc, union arg *arg)
|
|||||||
TAILQ_FOREACH(gc, &sc->groupq, entry) {
|
TAILQ_FOREACH(gc, &sc->groupq, entry) {
|
||||||
if (group_holds_only_sticky(gc))
|
if (group_holds_only_sticky(gc))
|
||||||
continue;
|
continue;
|
||||||
menuq_add(&menuq, gc,
|
menuq_add(&menuq, gc, "%d %s", gc->num, gc->name);
|
||||||
(group_holds_only_hidden(gc)) ? "%d: [%s]" : "%d: %s",
|
|
||||||
gc->num, gc->name);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
if ((mi = menu_filter(sc, &menuq, NULL, NULL, CWM_MENU_LIST,
|
if ((mi = menu_filter(sc, &menuq, NULL, NULL, CWM_MENU_LIST,
|
||||||
NULL, NULL)) != NULL) {
|
NULL, search_print_group)) != NULL) {
|
||||||
gc = (struct group_ctx *)mi->ctx;
|
gc = (struct group_ctx *)mi->ctx;
|
||||||
(group_holds_only_hidden(gc)) ?
|
(group_holds_only_hidden(gc)) ?
|
||||||
group_show(gc) : group_hide(gc);
|
group_show(gc) : group_hide(gc);
|
||||||
|
10
search.c
10
search.c
@ -137,6 +137,16 @@ search_print_cmd(struct menu *mi, int i)
|
|||||||
(special) ? "[%s]" : "%s", cmd->name);
|
(special) ? "[%s]" : "%s", cmd->name);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void
|
||||||
|
search_print_group(struct menu *mi, int i)
|
||||||
|
{
|
||||||
|
struct group_ctx *gc = (struct group_ctx *)mi->ctx;
|
||||||
|
|
||||||
|
(void)snprintf(mi->print, sizeof(mi->print),
|
||||||
|
(group_holds_only_hidden(gc)) ? "%d: [%s]" : "%d: %s",
|
||||||
|
gc->num, gc->name);
|
||||||
|
}
|
||||||
|
|
||||||
void
|
void
|
||||||
search_print_client(struct menu *mi, int list)
|
search_print_client(struct menu *mi, int list)
|
||||||
{
|
{
|
||||||
|
Loading…
Reference in New Issue
Block a user