diff options
author | Wynn Wolf Arbor | 2020-03-18 19:46:53 +0100 |
---|---|---|
committer | Wolfgang Müller | 2021-04-27 12:28:35 +0200 |
commit | c0f391e648f52cd9b8fa6e534a2f97a8ba0f46a9 (patch) | |
tree | 953c484d4a75cfcff94bdb3184b33136ef72ea4f | |
parent | 26a8c6ced076b6a49b130deb4fe35d6707bebbae (diff) | |
download | cwm-c0f391e648f52cd9b8fa6e534a2f97a8ba0f46a9.tar.gz |
Remove wm menu
Whilst arguably useful for certain people, or in rare cases, this
functionality is not needed in the general case.
This will also remove a memory leak where fallback was not properly
freed.
-rw-r--r-- | calmwm.c | 10 | ||||
-rw-r--r-- | calmwm.h | 5 | ||||
-rw-r--r-- | conf.c | 2 | ||||
-rw-r--r-- | cwm.1 | 4 | ||||
-rw-r--r-- | cwmrc.5 | 10 | ||||
-rw-r--r-- | kbfunc.c | 27 | ||||
-rw-r--r-- | search.c | 24 | ||||
-rw-r--r-- | util.c | 24 |
8 files changed, 4 insertions, 102 deletions
@@ -59,7 +59,7 @@ int main(int argc, char **argv) { char *display_name = NULL; - char *fallback; + char **saved_argv; int ch, xfd, nflag = 0; struct pollfd pfd[1]; @@ -69,8 +69,7 @@ main(int argc, char **argv) conf_init(&Conf); - fallback = u_argv(argv); - Conf.wm_argv = u_argv(argv); + saved_argv = argv; while ((ch = getopt(argc, argv, "c:d:nv")) != -1) { switch (ch) { case 'c': @@ -127,9 +126,8 @@ main(int argc, char **argv) } x_teardown(); if (cwm_status == CWM_EXEC_WM) { - u_exec(Conf.wm_argv); - warnx("'%s' failed to start, starting fallback", Conf.wm_argv); - u_exec(fallback); + execvp(saved_argv[0], saved_argv); + warnx("failed to re-exec"); } return 0; @@ -473,13 +473,10 @@ void search_match_group(struct menu_q *, struct menu_q *, char *); void search_match_text(struct menu_q *, struct menu_q *, char *); -void search_match_wm(struct menu_q *, struct menu_q *, - char *); void search_print_client(struct menu *, int); void search_print_cmd(struct menu *, int); void search_print_group(struct menu *, int); void search_print_text(struct menu *, int); -void search_print_wm(struct menu *, int); struct region_ctx *region_find(struct screen_ctx *, int, int); void screen_assert_clients_within(struct screen_ctx *); @@ -524,7 +521,6 @@ void kbfunc_group_toggle_all(void *, struct cargs *); void kbfunc_menu_client(void *, struct cargs *); void kbfunc_menu_cmd(void *, struct cargs *); void kbfunc_menu_group(void *, struct cargs *); -void kbfunc_menu_wm(void *, struct cargs *); void kbfunc_menu_exec(void *, struct cargs *); void kbfunc_client_menu_label(void *, struct cargs *); void kbfunc_exec_cmd(void *, struct cargs *); @@ -594,7 +590,6 @@ void xu_ewmh_handle_net_wm_state_msg(struct client_ctx *, void xu_ewmh_set_net_wm_state(struct client_ctx *); void xu_ewmh_restore_net_wm_state(struct client_ctx *); -char *u_argv(char * const *); void u_exec(char *); void u_spawn(char *); void log_debug(int, const char *, const char *, ...) @@ -182,7 +182,6 @@ static const struct { { FUNC_SC(menu-window, menu_client, CWM_MENU_WINDOW_ALL) }, { FUNC_SC(menu-window-hidden, menu_client, CWM_MENU_WINDOW_HIDDEN) }, { FUNC_SC(menu-exec, menu_exec, 0) }, - { FUNC_SC(menu-exec-wm, menu_wm, 0) }, { FUNC_SC(terminal, exec_term, 0) }, { FUNC_SC(lock, exec_lock, 0) }, @@ -209,7 +208,6 @@ static const struct { { "CM-Return", "terminal" }, { "CM-Delete", "lock" }, { "M-question", "menu-exec" }, - { "CM-w", "menu-exec-wm" }, { "M-Return", "window-hide" }, { "M-Down", "window-lower" }, { "M-Up", "window-raise" }, @@ -140,10 +140,6 @@ Resize window by a large amount; see Spawn .Dq exec program dialog. -.It Ic CM-w -Spawn -.Dq exec WindowManager -menu, allowing a switch to another window manager. .It Ic CMS-r Restart. .It Ic CMS-q @@ -230,12 +230,6 @@ after calling If set to 0, the vertical size of the master window will remain unchanged. The default is 50. -.It Ic wm Ar name path -Every -.Ar name -entry is shown in the wm menu. -When selected, the window manager is replaced by -.Ar path . .El .Sh BIND FUNCTION LIST .Bl -tag -width 23n -compact @@ -261,10 +255,6 @@ Launch group search menu. Launch .Dq exec program menu. -.It menu-exec-wm -Launch -.Dq exec WindowManager -menu. .It group-toggle-[n] Toggle visibility of group n, where n is 1-9. .It group-only-[n] @@ -592,33 +592,6 @@ kbfunc_menu_group(void *ctx, struct cargs *cargs) } void -kbfunc_menu_wm(void *ctx, struct cargs *cargs) -{ - struct screen_ctx *sc = ctx; - struct cmd_ctx *wm; - struct menu *mi; - struct menu_q menuq; - int mflags = 0; - - if (cargs->xev == CWM_XEV_BTN) - mflags |= CWM_MENU_LIST; - - TAILQ_INIT(&menuq); - TAILQ_FOREACH(wm, &Conf.wmq, entry) - menuq_add(&menuq, wm, NULL); - - if ((mi = menu_filter(sc, &menuq, "wm", NULL, mflags, - search_match_wm, search_print_wm)) != NULL) { - wm = (struct cmd_ctx *)mi->ctx; - free(Conf.wm_argv); - Conf.wm_argv = xstrdup(wm->path); - cwm_status = CWM_EXEC_WM; - } - - menuq_clear(&menuq); -} - -void kbfunc_menu_exec(void *ctx, struct cargs *cargs) { #define NPATHS 256 @@ -218,21 +218,6 @@ 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; @@ -271,12 +256,3 @@ 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); -} @@ -84,30 +84,6 @@ u_exec(char *argstr) warn("%s", s); } -char * -u_argv(char * const *argv) -{ - size_t siz = 0; - int i; - char *p; - - if (argv == 0) - return NULL; - - for (i = 0; argv[i]; i++) - siz += strlen(argv[i]) + 1; - if (siz == 0) - return NULL; - - p = xmalloc(siz); - strlcpy(p, argv[0], siz); - for (i = 1; argv[i]; i++) { - strlcat(p, " ", siz); - strlcat(p, argv[i], siz); - } - return p; -} - static void log_msg(const char *msg, va_list ap) { |