From 2a11357eadc60cb4e079683e7e45eb4e243551e4 Mon Sep 17 00:00:00 2001 From: DreamMaoMao <2523610504@qq.com> Date: Thu, 25 Sep 2025 10:28:59 +0800 Subject: [PATCH] feat: add comboview dispatch --- src/config/parse_config.h | 3 +++ src/dispatch/bind_declare.h | 1 + src/dispatch/bind_define.h | 16 ++++++++++++++++ src/mango.c | 4 ++++ 4 files changed, 24 insertions(+) diff --git a/src/config/parse_config.h b/src/config/parse_config.h index 4cec516..1b88b40 100644 --- a/src/config/parse_config.h +++ b/src/config/parse_config.h @@ -836,6 +836,9 @@ FuncType parse_func_name(char *func_name, Arg *arg, char *arg_value, } else if (strcmp(func_name, "toggleview") == 0) { func = toggleview; (*arg).ui = 1 << (atoi(arg_value) - 1); + } else if (strcmp(func_name, "comboview") == 0) { + func = comboview; + (*arg).ui = 1 << (atoi(arg_value) - 1); } else if (strcmp(func_name, "smartmovewin") == 0) { func = smartmovewin; (*arg).i = parse_direction(arg_value); diff --git a/src/dispatch/bind_declare.h b/src/dispatch/bind_declare.h index db9cb5c..2fe6298 100644 --- a/src/dispatch/bind_declare.h +++ b/src/dispatch/bind_declare.h @@ -44,6 +44,7 @@ void bind_to_view(const Arg *arg); void toggletag(const Arg *arg); void toggleview(const Arg *arg); void tag(const Arg *arg); +void comboview(const Arg *arg); void incgaps(const Arg *arg); void incigaps(const Arg *arg); void incihgaps(const Arg *arg); diff --git a/src/dispatch/bind_define.h b/src/dispatch/bind_define.h index cf7e5ba..26c8341 100644 --- a/src/dispatch/bind_define.h +++ b/src/dispatch/bind_define.h @@ -1280,6 +1280,22 @@ void viewtoright_have_client(const Arg *arg) { view(&(Arg){.ui = (1 << (n - 1)) & TAGMASK, .i = arg->i}, true); } +void comboview(const Arg *arg) { + uint32_t newtags = arg->ui & TAGMASK; + if (!newtags || !selmon) + return; + + if (tag_combo) + selmon->tagset[selmon->seltags] |= newtags; + else { + tag_combo = true; + selmon->tagset[selmon->seltags] = newtags; + } + focusclient(focustop(selmon), 1); + arrange(selmon, false); + printstatus(); +} + void zoom(const Arg *arg) { Client *c, *sel = focustop(selmon); diff --git a/src/mango.c b/src/mango.c index 53b85a6..22da5e3 100644 --- a/src/mango.c +++ b/src/mango.c @@ -784,6 +784,8 @@ struct dvec2 *baked_points_close; static struct wl_event_source *hide_source; static bool cursor_hidden = false; +static bool tag_combo = false; + static struct { enum wp_cursor_shape_device_v1_shape shape; struct wlr_surface *surface; @@ -3323,6 +3325,8 @@ void keypress(struct wl_listener *listener, void *data) { if (!locked && event->state == WL_KEYBOARD_KEY_STATE_PRESSED) { for (i = 0; i < nsyms; i++) handled = keybinding(mods, syms[i], keycode) || handled; + } else if (event->state == WL_KEYBOARD_KEY_STATE_RELEASED) { + tag_combo = false; } if (handled && group->wlr_group->keyboard.repeat_info.delay > 0) {