feat: add comboview dispatch

This commit is contained in:
DreamMaoMao 2025-09-25 10:28:59 +08:00
parent 6947ed3d3c
commit 2a11357ead
4 changed files with 24 additions and 0 deletions

View file

@ -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);

View file

@ -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);

View file

@ -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);

View file

@ -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) {