myvxwm

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

commit 1d67c953864d779f7663634c01458173fbfef0f9
parent 9bfa6c8bf071602786bb12779e2bbf0eddf3b975
Author: wh1tepearl <wh1tepearl@gmail.com>
Date:   Wed, 13 May 2026 16:06:17 +0100

add support for pinning windows and a small bugfix in centerwindow

Diffstat:
Mconfig.def.h | 1+
Mmodules/infinitetags/infinitetags.c | 23++++++++++++++++++-----
Mmodules/infinitetags/infinitetags.h | 1+
Mvxwm.c | 5+++++
4 files changed, 25 insertions(+), 5 deletions(-)

diff --git a/config.def.h b/config.def.h @@ -177,6 +177,7 @@ static const Key keys[] = { { MODKEY|ShiftMask, XK_Up, movecanvas, {.i = 2} }, // Move your position up { MODKEY|ShiftMask, XK_Down, movecanvas, {.i = 3} }, // Move your position down { MODKEY|ShiftMask, XK_d, centerwindow, {0} }, + { MODKEY|ControlMask, XK_z, pinwindow, {0} }, #endif #if DIRECTIONAL_FOCUS { ALTERNATE_MODKEY, XK_Left, focusdir, {.i = 0 } }, // left diff --git a/modules/infinitetags/infinitetags.c b/modules/infinitetags/infinitetags.c @@ -13,7 +13,7 @@ homecanvas(const Arg *arg) { int cy = selmon->canvas[tagidx].cy; for (c = selmon->clients; c; c = c->next) { - if (c->tags & (1 << tagidx)) { + if ((c->tags & (1 << tagidx)) && !c->is_pinned) { c->x -= cx; c->y -= cy; XMoveWindow(dpy, c->win, c->x, c->y); @@ -53,7 +53,7 @@ movecanvas(const Arg *arg) Client *c; for (c = selmon->clients; c; c = c->next) { - if (ISVISIBLE(c)) { + if (ISVISIBLE(c) && !c->is_pinned) { c->x -= dx; c->y -= dy; XMoveWindow(dpy, c->win, c->x, c->y); @@ -117,7 +117,7 @@ movecanvasmouse(const Arg *arg) { accum_y -= dy; for (Client *c = selmon->clients; c; c = c->next) { - if (c->tags & (1 << tagidx)) { + if ((c->tags & (1 << tagidx)) && !c->is_pinned) { c->x += dx; c->y += dy; XMoveWindow(dpy, c->win, c->x, c->y); @@ -193,10 +193,13 @@ centerwindow(const Arg *arg) if (!c || !c->mon || c->mon->lt[c->mon->sellt]->arrange != NULL) return; + if (c->is_pinned) + return; + Monitor *m = c->mon; int tagidx = getcurrenttag(m); - int dx = (m->wx + m->ww - WIDTH(c)) / 2 - c->x; + int dx = m->wx + (m->ww - WIDTH(c)) / 2 - c->x; int dy = m->wy + (m->wh / 2) - (c->y + HEIGHT(c) / 2); if (dx == 0 && dy == 0) @@ -204,7 +207,7 @@ centerwindow(const Arg *arg) Client *tmp; for (tmp = m->clients; tmp; tmp = tmp->next) { - if (ISVISIBLE(tmp)) { + if (ISVISIBLE(tmp) && !tmp->is_pinned) { tmp->x += dx; tmp->y += dy; XMoveWindow(dpy, tmp->win, tmp->x, tmp->y); @@ -216,3 +219,13 @@ centerwindow(const Arg *arg) drawbar(m); } + +void +pinwindow(const Arg *arg) { + Client *c = selmon->sel; + if (!c) + return; + c->is_pinned = !c->is_pinned; + restack(selmon); + drawbar(selmon); +} diff --git a/modules/infinitetags/infinitetags.h b/modules/infinitetags/infinitetags.h @@ -5,3 +5,4 @@ static int getcurrenttag(Monitor *m); static void save_canvas_positions(Monitor *m); static void restore_canvas_positions(Monitor *m); static void centerwindow(const Arg *arg); +static void pinwindow(const Arg *arg); diff --git a/vxwm.c b/vxwm.c @@ -141,6 +141,7 @@ struct Client { int saved_cx, saved_cy; int saved_cw, saved_ch; int was_on_canvas; + int is_pinned; #endif #if WINDOWMAP int ismapped; @@ -1789,6 +1790,10 @@ restack(Monitor *m) } } XRaiseWindow(dpy, m->barwin); + /* raise pinned windows because it is annoying when they are below others */ + for (c = m->stack; c; c = c->snext) + if (ISVISIBLE(c) && c->is_pinned) + XRaiseWindow(dpy, c->win); } #endif XSync(dpy, False);