diff options
author | okan | 2017-12-29 20:03:46 +0000 |
---|---|---|
committer | okan | 2017-12-29 20:03:46 +0000 |
commit | 9c7e3d61414a846c6b85d62f76177a30a255423a (patch) | |
tree | aa15f6cb2dfac7e58c47e964f980385218b2ead3 /search.c | |
parent | 94fa8f6008663944358afaeb58a1217cf564a95c (diff) | |
download | cwm-9c7e3d61414a846c6b85d62f76177a30a255423a.tar.gz |
Convert menu-exec-wm from an abritrary exec menu, into a config-based menu from
which one may configure (wm <name> <path_and_args>) (and choose) specific
window managers to replace the running one. 'wm cwm cwm' is included by
default.
No objections and seems sensible to sthen.
Diffstat (limited to 'search.c')
-rw-r--r-- | search.c | 26 |
1 files changed, 25 insertions, 1 deletions
@@ -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: search.c,v 1.66 2017/12/13 15:10:17 okan Exp $ + * $OpenBSD: search.c,v 1.67 2017/12/29 20:03:46 okan Exp $ */ #include <sys/types.h> @@ -228,6 +228,21 @@ search_match_text(struct menu_q *menuq, struct menu_q *resultq, char *search) } void +search_match_wm(struct menu_q *menuq, struct menu_q *resultq, char *search) +{ + struct menu *mi; + struct cmd_ctx *wm; + + TAILQ_INIT(resultq); + TAILQ_FOREACH(mi, menuq, entry) { + wm = (struct cmd_ctx *)mi->ctx; + if ((match_substr(search, wm->name, 0)) || + (match_substr(search, wm->path, 0))) + TAILQ_INSERT_TAIL(resultq, mi, resultentry); + } +} + +void search_print_client(struct menu *mi, int listing) { struct client_ctx *cc = (struct client_ctx *)mi->ctx; @@ -266,3 +281,12 @@ search_print_text(struct menu *mi, int listing) { (void)snprintf(mi->print, sizeof(mi->print), "%s", mi->text); } + +void +search_print_wm(struct menu *mi, int listing) +{ + struct cmd_ctx *wm = (struct cmd_ctx *)mi->ctx; + + (void)snprintf(mi->print, sizeof(mi->print), "%s [%s]", + wm->name, wm->path); +} |