From 43a850234ec20ab206ae06ee5dfe0968cfad220f Mon Sep 17 00:00:00 2001 From: stupidcomputer Date: Mon, 25 Nov 2024 21:14:07 -0600 Subject: [PATCH] add the cursorwarp patch --- dwm.c | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/dwm.c b/dwm.c index f1d86b2..252d18b 100644 --- a/dwm.c +++ b/dwm.c @@ -833,6 +833,8 @@ focusmon(const Arg *arg) unfocus(selmon->sel, 0); selmon = m; focus(NULL); + if (selmon->sel) + XWarpPointer(dpy, None, selmon->sel->win, 0, 0, 0, 0, selmon->sel->w/2, selmon->sel->h/2); } void @@ -858,6 +860,7 @@ focusstack(const Arg *arg) if (c) { focus(c); restack(selmon); + XWarpPointer(dpy, None, c->win, 0, 0, 0, 0, c->w/2, c->h/2); } } @@ -1085,6 +1088,8 @@ manage(Window w, XWindowAttributes *wa) c->mon->sel = c; arrange(c->mon); XMapWindow(dpy, c->win); + if (c && c->mon == selmon) + XWarpPointer(dpy, None, c->win, 0, 0, 0, 0, c->w/2, c->h/2); focus(NULL); } @@ -1799,6 +1804,9 @@ unmanage(Client *c, int destroyed) focus(NULL); updateclientlist(); arrange(m); + if (m == selmon && m->sel) + XWarpPointer(dpy, None, m->sel->win, 0, 0, 0, 0, + m->sel->w/2, m->sel->h/2); } void