opt: allow none mode in some mouse button

This commit is contained in:
DreamMaoMao 2026-02-09 07:52:10 +08:00
parent 765248318d
commit 6e4dabef8e
2 changed files with 15 additions and 9 deletions

View file

@ -219,12 +219,11 @@ bind=CTRL+ALT,Left,resizewin,-50,+0
bind=CTRL+ALT,Right,resizewin,+50,+0
# Mouse Button Bindings
# NONE mode key only work in ov mode
# btn_left and btn_right can't bind none mod key
mousebind=SUPER,btn_left,moveresize,curmove
mousebind=NONE,btn_middle,togglemaximizescreen,0
mousebind=SUPER,btn_right,moveresize,curresize
mousebind=NONE,btn_left,toggleoverview,1
mousebind=NONE,btn_right,killclient,0
# Axis Bindings
axisbind=SUPER,UP,viewtoleft_have_client

View file

@ -2008,14 +2008,21 @@ buttonpress(struct wl_listener *listener, void *data) {
if (config.mouse_bindings_count < 1)
break;
m = &config.mouse_bindings[ji];
if (selmon->isoverview && event->button == BTN_LEFT && c) {
toggleoverview(&(Arg){.i = 1});
return;
}
if (selmon->isoverview && event->button == BTN_RIGHT && c) {
pending_kill_client(c);
return;
}
if (CLEANMASK(mods) == CLEANMASK(m->mod) &&
event->button == m->button && m->func &&
(selmon->isoverview == 1 || m->button == BTN_MIDDLE) && c) {
m->func(&m->arg);
return;
} else if (CLEANMASK(mods) == CLEANMASK(m->mod) &&
event->button == m->button && m->func &&
CLEANMASK(m->mod) != 0) {
(CLEANMASK(m->mod) != 0 ||
(event->button != BTN_LEFT && event->button != BTN_RIGHT))) {
m->func(&m->arg);
return;
}