From 3cea1eae36c79250822a666c52180251621b0ff0 Mon Sep 17 00:00:00 2001 From: Rutherther Date: Fri, 19 Jul 2024 16:04:13 +0200 Subject: [PATCH] Move mouse to center of monitor if focused again --- dwl.c | 10 +++++++++- 1 file changed, 9 insertions(+), 1 deletion(-) diff --git a/dwl.c b/dwl.c index eea12c2..8557261 100644 --- a/dwl.c +++ b/dwl.c @@ -1449,8 +1449,16 @@ void focusnthmon(const Arg *arg) { Monitor *m = numtomon(arg->i); - if (!m || m == selmon) + if (!m) + return; + + if (m == selmon) { + double target_x = m->m.x + m->m.width / 2; + double target_y = m->m.y + m->m.height / 2; + wlr_cursor_move(cursor, NULL, target_x - cursor->x, target_y - cursor->y); return; + } + selmon = m; focusclient(focustop(selmon), 1); } -- 2.48.1