From 99854aa4ea876ad25b387a266e490f8f12a09eae Mon Sep 17 00:00:00 2001 From: DreamMaoMao <2523610504@qq.com> Date: Thu, 30 Oct 2025 22:20:13 +0800 Subject: [PATCH] opt: optimize viewcrossmon --- src/dispatch/bind_define.h | 7 ++----- 1 file changed, 2 insertions(+), 5 deletions(-) diff --git a/src/dispatch/bind_define.h b/src/dispatch/bind_define.h index 8c25efb..5a092cc 100644 --- a/src/dispatch/bind_define.h +++ b/src/dispatch/bind_define.h @@ -185,7 +185,7 @@ int focusmon(const Arg *arg) { return 0; } - if (!m || !m->wlr_output->enabled) + if (!m || !m->wlr_output->enabled || m == selmon) return 0; old_selmon_sel = selmon->sel; @@ -1423,10 +1423,7 @@ int viewtoright_have_client(const Arg *arg) { } int viewcrossmon(const Arg *arg) { - // Don't switch monitors if monitor is already focused - // This also prevents cursorwarp - if (!regex_match(arg->v, selmon->wlr_output->name)) - focusmon(&(Arg){.v = arg->v, .i = UNDIR}); + focusmon(&(Arg){.v = arg->v, .i = UNDIR}); view_in_mon(arg, true, selmon, true); return 0; }