commit 1a1d308e329d529a24a040683776b5e984e30a41
parent f6de52066b83cfef62cf6adc4442a919ac404969
Author: mrgrouse <bdmfegys@duck.com>
Date: Fri, 4 Jul 2025 02:18:03 -0400
birdwm.c: add cursor warping for refocus and window spawn/death
Diffstat:
1 file changed, 8 insertions(+), 0 deletions(-)
diff --git a/birdwm.c b/birdwm.c
@@ -1000,6 +1000,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
@@ -1025,6 +1027,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);
}
}
@@ -1368,6 +1371,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);
}
@@ -2260,6 +2265,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