diff --git a/client/common/common.c b/client/common/common.c index 971f2cf..6bbfca2 100644 --- a/client/common/common.c +++ b/client/common/common.c @@ -309,7 +309,7 @@ do_getopt(struct client *client, int *argc, char **argv[]) client->grab = true; break; case 'm': - client->monitor = strtol(optarg, NULL, 10); + client->monitor = (!strcmp(optarg, "all") ? -1 : strtol(optarg, NULL, 10)); break; case 'n': client->no_overlap = true; diff --git a/lib/renderers/wayland/wayland.c b/lib/renderers/wayland/wayland.c index bf37028..1714a1b 100644 --- a/lib/renderers/wayland/wayland.c +++ b/lib/renderers/wayland/wayland.c @@ -241,16 +241,18 @@ recreate_windows(const struct bm_menu *menu, struct wayland *wayland) { destroy_windows(wayland); - size_t monitors = 0; + uint32_t monitors = 0; struct output *output; wl_list_for_each(output, &wayland->outputs, link) monitors++; - size_t monitor = 0; + uint32_t monitor = 0; wl_list_for_each(output, &wayland->outputs, link) { - if (menu->monitor < monitors && monitor != menu->monitor) { - ++monitor; - continue; + if (menu->monitor != (uint32_t)-1) { + if (menu->monitor < monitors && monitor != menu->monitor) { + ++monitor; + continue; + } } struct wl_surface *surface; @@ -270,7 +272,7 @@ recreate_windows(const struct bm_menu *menu, struct wayland *wayland) window->max_height = output->height; window->render_pending = true; wl_list_insert(&wayland->windows, &window->link); - break; + if (menu->monitor != (uint32_t)-1) break; } set_overlap(menu, menu->overlap); diff --git a/lib/renderers/x11/x11.c b/lib/renderers/x11/x11.c index d5cfe51..6721f5b 100644 --- a/lib/renderers/x11/x11.c +++ b/lib/renderers/x11/x11.c @@ -177,7 +177,7 @@ set_monitor(const struct bm_menu *menu, uint32_t monitor) { struct x11 *x11 = menu->renderer->internal; assert(x11); - bm_x11_window_set_monitor(&x11->window, monitor); + bm_x11_window_set_monitor(&x11->window, (monitor != (uint32_t)-1 ? monitor : 0)); } static void diff --git a/man/bemenu.1 b/man/bemenu.1 index 5c6cf74..7e91291 100644 --- a/man/bemenu.1 +++ b/man/bemenu.1 @@ -121,6 +121,7 @@ These options are only available on backends specified in the parentheses .TP .BI \-m " INDEX" ", \-\-monitor=" INDEX (Wayland, X11) Specify \fIINDEX\fR of the monitor where the menu should appear. +(Wayland) If index is \fI-1\fR or \fIall\fR then the menu will appear on all monitors. .TP .BI \-H " HEIGHT" ", \-\-line\-height=" HEIGHT