myvxwm

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

commit 19f35bac141ffd9a35a535e8b7fd4ad65dcabcd9
parent 3f5850b1255ea1543c13385bf45caa1c673222b8
Author: wh1tepearl <wh1tepearl@gmail.com>
Date:   Tue, 17 Feb 2026 16:58:17 +0000

Bug fix and WARP_TO_CENTER_OF_WINDOW_MOVED_BY_KEYBOARD support

Diffstat:
Mmodules.def.h | 1+
Mmodules/moveresizekbd/moveresizekbd.c | 127+++++++++++++++++++++++++++++++++++++++++++++++--------------------------------
Mvxwm.c | 29++++++++++++++++++++++++-----
3 files changed, 101 insertions(+), 56 deletions(-)

diff --git a/modules.def.h b/modules.def.h @@ -70,6 +70,7 @@ Even though this sounds complex, it is actually pretty lightweight ~250 l.o.c, a #define WARP_TO_CENTER_OF_WINDOW_AFFECTED_BY_INCNMASTER 0 // Warps the cursor to center of the window that gets affected in use of incnmaster. #define WARP_TO_CENTER_OF_WINDOW_AFFECTED_BY_ENHANCED_TOGGLE_FLOATING 0 // Warps cursor to center of the window that was affected by using enhancedtogglefloating function. #define WARP_TO_CENTER_OF_WINDOW_AFFECTED_BY_FOCUSSTACK 0 // Warps cursor to center of the window that was focused by using focusstack function. +#define WARP_TO_CENTER_OF_WINDOW_MOVED_BY_KEYBOARD 0 // Warps cursor to center of the window that is moved by moveresize function. diff --git a/modules/moveresizekbd/moveresizekbd.c b/modules/moveresizekbd/moveresizekbd.c @@ -1,74 +1,99 @@ +#if !INFINITE_TAGS void moveresize(const Arg *arg) { - if (selmon->lt[selmon->sellt]->arrange != NULL) - return; + XEvent ev; + Monitor *m = selmon; + if(!(m->sel && arg && arg->v && m->sel->isfloating)) + return; + + resize(m->sel, m->sel->x + ((int *)arg->v)[0], + m->sel->y + ((int *)arg->v)[1], + m->sel->w + ((int *)arg->v)[2], + m->sel->h + ((int *)arg->v)[3], + True); +#if WARP_TO_CLIENT && WARP_TO_CENTER_OF_WINDOW_MOVED_BY_KEYBOARD + warptoclient(m->sel); +#endif + while(XCheckMaskEvent(dpy, EnterWindowMask, &ev)); +} + +#else + +void +moveresize(const Arg *arg) +{ + + XEvent ev; Monitor *m = selmon; + if(!(m->sel && arg && arg->v && m->sel->isfloating)) + return; + if (selmon->lt[selmon->sellt]->arrange != NULL) { + resize(m->sel, m->sel->x + ((int *)arg->v)[0], + m->sel->y + ((int *)arg->v)[1], + m->sel->w + ((int *)arg->v)[2], + m->sel->h + ((int *)arg->v)[3], + True); +#if WARP_TO_CLIENT && WARP_TO_CENTER_OF_WINDOW_MOVED_BY_KEYBOARD + warptoclient(m->sel); +#endif + while(XCheckMaskEvent(dpy, EnterWindowMask, &ev)); + return; + } Client *c = m->sel; -#if INFINITE_TAGS int tagidx = getcurrenttag(m); -#endif - if (!(c && arg && arg->v && c->isfloating)) - return; int dx = ((int *)arg->v)[0]; int dy = ((int *)arg->v)[1]; int dw = ((int *)arg->v)[2]; int dh = ((int *)arg->v)[3]; - if (dw != 0 || dh != 0) { - if (c->x + c->w + dw > m->mw) - return; - - if (c->y + c->h + dh > m->mh) - return; + int nx = c->x + dx; + int ny = c->y + dy; + int nw = c->w + dw; + int nh = c->h + dh; - resize(c, c->x, c->y, c->w + dw, c->h + dh, True); - - XEvent ev; - while (XCheckMaskEvent(dpy, EnterWindowMask, &ev)); - return; - } + int canvas_dx = 0, canvas_dy = 0; if (dx != 0 || dy != 0) { - resize(c, c->x + dx, c->y + dy, c->w, c->h, True); + if (nx < m->wx) { + canvas_dx = nx - m->wx; + nx = m->wx; + } else if (nx + nw + 2 * c->bw > m->wx + m->ww) { + canvas_dx = (nx + nw + 2 * c->bw) - (m->wx + m->ww); + nx = m->wx + m->ww - nw - 2 * c->bw; + } -#if INFINITE_TAGS - int canvas_dx = 0; - int canvas_dy = 0; + if (ny < m->wy) { + canvas_dy = ny - m->wy; + ny = m->wy; + } else if (ny + nh + 2 * c->bw > m->wy + m->wh) { + canvas_dy = (ny + nh + 2 * c->bw) - (m->wy + m->wh); + ny = m->wy + m->wh - nh - 2 * c->bw; + } - if (c->x < 0) { - canvas_dx = c->x; - } - else if (c->x + WIDTH(c) > m->mw) { - canvas_dx = (c->x + WIDTH(c)) - m->mw; - } + if (canvas_dx != 0 || canvas_dy != 0) { + m->canvas[tagidx].cx -= canvas_dx; + m->canvas[tagidx].cy -= canvas_dy; - if (c->y < 0) { - canvas_dy = c->y; - } - else if (c->y + HEIGHT(c) > m->mh) { - canvas_dy = (c->y + HEIGHT(c)) - m->mh; + Client *tmp; + for (tmp = m->clients; tmp; tmp = tmp->next) { + if (ISVISIBLE(tmp) && tmp != c) { + tmp->x -= canvas_dx; + tmp->y -= canvas_dy; + XMoveWindow(dpy, tmp->win, tmp->x, tmp->y); + } } - - if (canvas_dx != 0 || canvas_dy != 0) { - m->canvas[tagidx].cx += canvas_dx; - m->canvas[tagidx].cy += canvas_dy; - - Client *tmp; - for (tmp = m->clients; tmp; tmp = tmp->next) { - if (ISVISIBLE(tmp)) { - tmp->x -= canvas_dx; - tmp->y -= canvas_dy; - XMoveWindow(dpy, tmp->win, tmp->x, tmp->y); - } - } - drawbar(m); - } -#endif + } } - XEvent ev; - while (XCheckMaskEvent(dpy, EnterWindowMask, &ev)); + resize(c, nx, ny, nw, nh, True); + focus(c); +#if WARP_TO_CLIENT && WARP_TO_CENTER_OF_WINDOW_MOVED_BY_KEYBOARD + warptoclient(c); +#endif + while(XCheckMaskEvent(dpy, EnterWindowMask, &ev)); + drawbar(m); } +#endif diff --git a/vxwm.c b/vxwm.c @@ -2086,11 +2086,30 @@ spawn(const Arg *arg) void tag(const Arg *arg) { - if (selmon->sel && arg->ui & TAGMASK) { - selmon->sel->tags = arg->ui & TAGMASK; - focus(NULL); - arrange(selmon); - } + if (selmon->sel && arg->ui & TAGMASK) { +#if INFINITE_TAGS + Client *c = selmon->sel; + unsigned int target_tag_mask = arg->ui & TAGMASK; + int i; + + for (i = 0; i < LENGTH(tags); i++) { + if (target_tag_mask & (1 << i)) { + + c->saved_cx = selmon->canvas[i].cx + (selmon->ww - WIDTH(c)) / 2; + c->saved_cy = selmon->canvas[i].cy + (selmon->wh - HEIGHT(c)) / 2; + c->saved_cw = c->w; + c->saved_ch = c->h; + c->was_on_canvas = 1; + + break; + } + } +#endif + + selmon->sel->tags = arg->ui & TAGMASK; + focus(NULL); + arrange(selmon); + } } void