diff options
| author | Fuwn <[email protected]> | 2024-01-14 17:17:37 -0800 |
|---|---|---|
| committer | Fuwn <[email protected]> | 2024-01-14 17:17:37 -0800 |
| commit | 34cde22b173d0c2b250860686d118cbc23e99664 (patch) | |
| tree | c9f57bfc124dfbcebcf75e621acc799c81cde777 | |
| parent | docs(readme): update dependencies (diff) | |
| download | seiwm-34cde22b173d0c2b250860686d118cbc23e99664.tar.xz seiwm-34cde22b173d0c2b250860686d118cbc23e99664.zip | |
feat(sei.c): cursorwarp patch
| -rw-r--r-- | README.md | 2 | ||||
| -rw-r--r-- | config.h | 2 | ||||
| -rw-r--r-- | sei.c | 12 |
3 files changed, 15 insertions, 1 deletions
@@ -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 @@ -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 */ @@ -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); } } |