From f8dd1e5c3cb263ec546720a881f0f5116f8926db Mon Sep 17 00:00:00 2001 From: Rutherther Date: Tue, 30 Apr 2024 20:22:53 +0200 Subject: [PATCH] feat: 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 8998800..3353de3 100644 --- a/dwl.c +++ b/dwl.c @@ -1347,8 +1347,16 @@ void focusnthmon(const Arg *arg) { Monitor *m = numtomon(arg->i); - if (m == selmon || m == NULL) + if (m == NULL) { 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