myvxwm

[fork] my vxwm config (optimised for my T480)
git clone https://git.lukeonline.net/repos/myvxwm
Log | Files | Refs | README | LICENSE

commit 3afca1f11237a1a5fabe354b6da31062c6a7ebea
parent 49ec9ae7be6c3b73f365746bfd5c715fbfe0b922
Author: wh1tepearl <wh1tepearl@gmail.com>
Date:   Sat, 24 Jan 2026 22:32:57 +0000

Added support for warp to client

Diffstat:
Mmodules.def.h | 2++
Mmodules/vxwm_includes.c | 4++++
Mmodules/vxwm_includes.h | 4++++
Amodules/warptoclient/warptoclient.c | 15+++++++++++++++
Amodules/warptoclient/warptoclient.h | 1+
Mvxwm.c | 51+++++++++++++++++++++++++++++++++++++++++++++++++++
6 files changed, 77 insertions(+), 0 deletions(-)

diff --git a/modules.def.h b/modules.def.h @@ -14,5 +14,7 @@ #define MOVE_IN_TILED 0 //support for moving windows in tiled mode #define EWMH_TAGS 0 //support for EWMH tags, recommended if you want to use external bars with less pain #define ALWAYS_CENTER_NEW_FLOATING_WINDOWS 0 //so, basically, it does what it says +#define WARP_TO_CLIENT 0 //it warps cursor, where? idk, but use it trust me bro +#define WARP_TO_CLIENT_AFFECTED_BY_INCNMASTER 0 #endif diff --git a/modules/vxwm_includes.c b/modules/vxwm_includes.c @@ -17,4 +17,8 @@ #include "ewmh_tags/ewmh_tags.c" #endif +#if WARP_TO_CLIENT +#include "warptoclient/warptoclient.c" +#endif + #endif diff --git a/modules/vxwm_includes.h b/modules/vxwm_includes.h @@ -17,4 +17,8 @@ #include "ewmh_tags/ewmh_tags.h" #endif +#if WARP_TO_CLIENT +#include "warptoclient/warptoclient.h" +#endif + #endif diff --git a/modules/warptoclient/warptoclient.c b/modules/warptoclient/warptoclient.c @@ -0,0 +1,15 @@ +void +warptoclient(Client *c) +{ + int x, y; + + if (!c) { + XWarpPointer(dpy, None, root, 0, 0, 0, 0, selmon->wx + selmon->ww/2, selmon->wy + selmon->wh/2); + return; + } + + x = c->x + c->w / 2; + y = c->y + c->h / 2; + + XWarpPointer(dpy, None, root, 0, 0, 0, 0, x, y); +} diff --git a/modules/warptoclient/warptoclient.h b/modules/warptoclient/warptoclient.h @@ -0,0 +1 @@ +void warptoclient(Client *c); diff --git a/vxwm.c b/vxwm.c @@ -1014,12 +1014,49 @@ grabkeys(void) } } +#if !WARP_TO_CLIENT //nah bro larp to client void incnmaster(const Arg *arg) { selmon->nmaster = MAX(selmon->nmaster + arg->i, 0); arrange(selmon); } +#elif WARP_TO_CLIENT && !WARP_TO_CLIENT_AFFECTED_BY_INCNMASTER +void +incnmaster(const Arg *arg) +{ + selmon->nmaster = MAX(selmon->nmaster + arg->i, 0); + arrange(selmon); + if (selmon->sel) warptoclient(selmon->sel); +} +#else +void +incnmaster(const Arg *arg) +{ + Client *c; + unsigned int n; + + Client *moved = NULL; + + for (n = 0, c = nexttiled(selmon->clients); c; c = nexttiled(c->next), n++); + + if (arg->i > 0) { + moved = nexttiled(selmon->clients); + for (n = 0; moved && n < selmon->nmaster; n++) + moved = nexttiled(moved->next); + } else if (arg->i < 0 && selmon->nmaster > 0) { + moved = nexttiled(selmon->clients); + for (n = 1; moved && n < selmon->nmaster; n++) + moved = nexttiled(moved->next); + } + + selmon->nmaster = MAX(selmon->nmaster + arg->i, 0); + arrange(selmon); + + if (moved) + warptoclient(moved); +} +#endif #ifdef XINERAMA static int @@ -1127,6 +1164,10 @@ manage(Window w, XWindowAttributes *wa) arrange(c->mon); XMapWindow(dpy, c->win); focus(NULL); +#if WARP_TO_CLIENT + warptoclient(c); + focus(c); +#endif } void @@ -2061,6 +2102,10 @@ unmanage(Client *c, int destroyed) focus(NULL); updateclientlist(); arrange(m); +#if WARP_TO_CLIENT + if (m == selmon && m->sel) + warptoclient(m->sel); +#endif } void @@ -2411,12 +2456,18 @@ void zoom(const Arg *arg) { Client *c = selmon->sel; +#if WARP_TO_CLIENT + Client *target = c; +#endif if (!selmon->lt[selmon->sellt]->arrange || !c || c->isfloating) return; if (c == nexttiled(selmon->clients) && !(c = nexttiled(c->next))) return; pop(c); +#if WARP_TO_CLIENT + warptoclient(target); +#endif } int