myvxwm

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

commit 8c86751c79bd418bed3010f7c641f99f3da6b791
parent 61fdff7521effed439ced6bd9152bf10d7815bae
Author: wh1tepearl <wh1tepearl@gmail.com>
Date:   Mon, 30 Mar 2026 19:26:57 +0100

add support for multipliers in manuallymovecanvas (movecanvasmouse now), and rename it to movecanvasmouse

Diffstat:
Mconfig.def.h | 6++++--
Mmodules/infinitetags/infinitetags.c | 30+++++++++++++++++++++++-------
Mmodules/infinitetags/infinitetags.h | 2+-
Mvxwm.c | 3+++
4 files changed, 31 insertions(+), 10 deletions(-)

diff --git a/config.def.h b/config.def.h @@ -188,8 +188,10 @@ static const Key keys[] = { static const Button buttons[] = { /* click event mask button function argument */ #if INFINITE_TAGS - { ClkRootWin, MODKEY|ShiftMask, Button1, manuallymovecanvas, {0} }, - { ClkClientWin, MODKEY|ShiftMask, Button1, manuallymovecanvas, {0} }, + { ClkRootWin, MODKEY|ShiftMask, Button1, movecanvasmouse, {.f = 1.5 } }, + { ClkClientWin, MODKEY|ShiftMask, Button1, movecanvasmouse, {.f = 1.5 } }, + /* .f = 1 is moving multiplier, for example if set to 0.5, canvas will move 2 times slower, if set to 2, canvas will move 2 times faster. + If you want inverted canvas move then set the value to a negative value. */ #endif { ClkLtSymbol, 0, Button1, setlayout, {0} }, { ClkLtSymbol, 0, Button3, setlayout, {.v = &layouts[2]} }, diff --git a/modules/infinitetags/infinitetags.c b/modules/infinitetags/infinitetags.c @@ -64,7 +64,7 @@ movecanvas(const Arg *arg) } void -manuallymovecanvas(const Arg *arg) { +movecanvasmouse(const Arg *arg) { if (selmon->lt[selmon->sellt]->arrange != NULL) return; if (selmon->sel && selmon->sel->isfullscreen) @@ -74,6 +74,9 @@ manuallymovecanvas(const Arg *arg) { int di; unsigned int dui; int tagidx = getcurrenttag(selmon); + float multiplier = arg ? arg->f : 1.0f; + float accum_x = 0.0f, accum_y = 0.0f; + #if LOCK_MOVE_RESIZE_REFRESH_RATE Time lasttime = 0; #endif @@ -99,17 +102,30 @@ manuallymovecanvas(const Arg *arg) { #endif int nx = ev.xmotion.x - start_x; int ny = ev.xmotion.y - start_y; - + + /* accumulate subpixel remainder to not lose fractional pixels: + multiplier=0.5, nx=1: accum=0.5, dx=0 --- skip + nx=1: accum=1.0, dx=1 --- move + */ + accum_x += nx * multiplier; + accum_y += ny * multiplier; + + int dx = (int)accum_x; + int dy = (int)accum_y; + + accum_x -= dx; + accum_y -= dy; + for (Client *c = selmon->clients; c; c = c->next) { if (c->tags & (1 << tagidx)) { - c->x += nx; - c->y += ny; + c->x += dx; + c->y += dy; XMoveWindow(dpy, c->win, c->x, c->y); } } - - selmon->canvas[tagidx].cx += nx; - selmon->canvas[tagidx].cy += ny; + + selmon->canvas[tagidx].cx += dx; + selmon->canvas[tagidx].cy += dy; drawbar(selmon); start_x = ev.xmotion.x; start_y = ev.xmotion.y; diff --git a/modules/infinitetags/infinitetags.h b/modules/infinitetags/infinitetags.h @@ -1,5 +1,5 @@ static void movecanvas(const Arg *arg); -static void manuallymovecanvas(const Arg *arg); +static void movecanvasmouse(const Arg *arg); static void homecanvas(const Arg *arg); static int getcurrenttag(Monitor *m); static void save_canvas_positions(Monitor *m); diff --git a/vxwm.c b/vxwm.c @@ -4,6 +4,9 @@ Infinite tags module is heavily inspired from 5element which is inspired from th vxwm 2.2 // by wh1tepearl +I just realised that i haven't commenting the entire code, sure i can perfectly read it but for the people that want to fork vxwm/make something with vxwm's code it is a pain in the ass. +From this moment, i'll try to comment the code and also make it more readable. + */ // Modules configuration is in modules.h