aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorFuwn <[email protected]>2024-01-14 17:17:37 -0800
committerFuwn <[email protected]>2024-01-14 17:17:37 -0800
commit34cde22b173d0c2b250860686d118cbc23e99664 (patch)
treec9f57bfc124dfbcebcf75e621acc799c81cde777
parentdocs(readme): update dependencies (diff)
downloadseiwm-34cde22b173d0c2b250860686d118cbc23e99664.tar.xz
seiwm-34cde22b173d0c2b250860686d118cbc23e99664.zip
feat(sei.c): cursorwarp patch
-rw-r--r--README.md2
-rw-r--r--config.h2
-rw-r--r--sei.c12
3 files changed, 15 insertions, 1 deletions
diff --git a/README.md b/README.md
index f00dafb..e2576dc 100644
--- a/README.md
+++ b/README.md
@@ -70,3 +70,5 @@ makepkg -si
- [nametag](https://dwm.suckless.org/patches/nametag/): Name tags using <kbd>mod+n</kbd>
- [centretitle](https://dwm.suckless.org/patches/centretitle/): Optionally
centre the focused client's title
+- [cursor](https://dwm.suckless.org/patches/cursorwarp/): Warps the mouse cursor
+ to the center of the target window when changing focus
diff --git a/config.h b/config.h
index 0d97528..e4598fd 100644
--- a/config.h
+++ b/config.h
@@ -12,7 +12,7 @@ static const char *wmname = "sei";
static unsigned int borderpx = 2; /* border pixel of windows */
static unsigned int snap = 32; /* snap pixel */
static const unsigned int systraypinning =
- 0; /* 0: sloppy systray follows selected monitor, >0: pin systray to monitor
+ 1; /* 0: sloppy systray follows selected monitor, >0: pin systray to monitor
X */
static const unsigned int systrayonleft =
1; /* 0: systray in the right corner, >0: systray on left of status text */
diff --git a/sei.c b/sei.c
index 936711e..e9aba1b 100644
--- a/sei.c
+++ b/sei.c
@@ -1282,6 +1282,9 @@ void 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 focusstack(const Arg *arg) {
@@ -1296,6 +1299,7 @@ void focusstack(const Arg *arg) {
;
focus(c ? c : p);
restack(selmon);
+ XWarpPointer(dpy, None, c->win, 0, 0, 0, 0, c->w / 2, c->h / 2);
}
Atom getatomprop(Client *c, Atom prop) {
@@ -1657,6 +1661,8 @@ void manage(Window w, XWindowAttributes *wa) {
swallow(term, c);
arrange(c->mon);
focus(NULL);
+ if (c && c->mon == selmon)
+ XWarpPointer(dpy, None, c->win, 0, 0, 0, 0, c->w / 2, c->h / 2);
}
void mappingnotify(XEvent *e) {
@@ -2581,6 +2587,9 @@ void unmanage(Client *c, int destroyed) {
s->swallowing = NULL;
arrange(m);
focus(NULL);
+ if (m == selmon && m->sel)
+ XWarpPointer(dpy, None, m->sel->win, 0, 0, 0, 0, m->sel->w / 2,
+ m->sel->h / 2);
return;
}
@@ -2605,6 +2614,9 @@ void unmanage(Client *c, int destroyed) {
arrange(m);
focus(NULL);
updateclientlist();
+ if (m == selmon && m->sel)
+ XWarpPointer(dpy, None, m->sel->win, 0, 0, 0, 0, m->sel->w / 2,
+ m->sel->h / 2);
}
}