diff --git a/calmwm.h b/calmwm.h index 6c23615..32cf00f 100644 --- a/calmwm.h +++ b/calmwm.h @@ -449,6 +449,7 @@ void search_match_path_any(struct menu_q *, struct menu_q *, void search_match_text(struct menu_q *, struct menu_q *, char *); void search_print_client(struct menu *, int); +void search_print_cmd(struct menu *, int); struct geom screen_apply_gap(struct screen_ctx *, struct geom); struct screen_ctx *screen_find(Window); diff --git a/kbfunc.c b/kbfunc.c index c7de00d..a107b95 100644 --- a/kbfunc.c +++ b/kbfunc.c @@ -181,7 +181,7 @@ kbfunc_menu_cmd(struct client_ctx *cc, union arg *arg) menuq_add(&menuq, cmd, "%s", cmd->name); if ((mi = menu_filter(sc, &menuq, "application", NULL, 0, - search_match_text, NULL)) != NULL) + search_match_text, search_print_cmd)) != NULL) u_spawn(((struct cmd *)mi->ctx)->path); menuq_clear(&menuq); diff --git a/mousefunc.c b/mousefunc.c index 8ba56be..bc31118 100644 --- a/mousefunc.c +++ b/mousefunc.c @@ -239,7 +239,7 @@ mousefunc_menu_cmd(struct client_ctx *cc, union arg *arg) menuq_add(&menuq, cmd, "%s", cmd->name); if ((mi = menu_filter(sc, &menuq, NULL, NULL, CWM_MENU_LIST, - NULL, NULL)) != NULL) + NULL, search_print_cmd)) != NULL) u_spawn(((struct cmd *)mi->ctx)->path); menuq_clear(&menuq); diff --git a/search.c b/search.c index edb3421..9013a9d 100644 --- a/search.c +++ b/search.c @@ -123,6 +123,20 @@ search_match_client(struct menu_q *menuq, struct menu_q *resultq, char *search) } } +void +search_print_cmd(struct menu *mi, int i) +{ + struct cmd *cmd = (struct cmd *)mi->ctx; + int special = 0; + + if ((strcmp(cmd->name, "lock") == 0) || + (strcmp(cmd->name, "term") == 0)) + special = 1; + + (void)snprintf(mi->print, sizeof(mi->print), + (special) ? "[%s]" : "%s", cmd->name); +} + void search_print_client(struct menu *mi, int list) {