[wiki] [sites] [dwm][patch][tiledmove] add patch || Niki

From: <git_AT_suckless.org>
Date: Tue, 12 Dec 2023 19:23:04 +0100

commit 34d7769abe6674310a9b505171b5c73cfbc6031a
Author: Niki <schat_AT_cock.li>
Date: Tue Dec 12 18:21:33 2023 +0000

    [dwm][patch][tiledmove] add patch
    
    Patch to make the function `movemouse` not force clients to float.
    
    Tiled clients when moved will swap with other tiled clients that
    overlap with the cursor, and snap to other monitors.

diff --git a/dwm.suckless.org/patches/tiledmove/dwm-tiledmove-20231210-b731.diff b/dwm.suckless.org/patches/tiledmove/dwm-tiledmove-20231210-b731.diff
new file mode 100644
index 00000000..ad5b7e9a
--- /dev/null
+++ b/dwm.suckless.org/patches/tiledmove/dwm-tiledmove-20231210-b731.diff
_AT_@ -0,0 +1,83 @@
+From 427c5fef13676179621949f0a8a4036e49d4b74e Mon Sep 17 00:00:00 2001
+From: Niki <>
+Date: Sun, 10 Dec 2023 00:29:59 +0000
+Subject: [PATCH] The function `movemouse` now doesn't force clients to be
+ floating.
+
+Tiling clients when moved will swap with any existing clients that
+overlap with the cursor, and snap to other monitors.
+---
+ dwm.c | 56 +++++++++++++++++++++++++++++++++++++++++++++++++++++---
+ 1 file changed, 53 insertions(+), 3 deletions(-)
+
+diff --git a/dwm.c b/dwm.c
+index d12be2d..b1023e0 100644
+--- a/dwm.c
++++ b/dwm.c
+_AT_@ -1189,11 +1189,60 @@ movemouse(const Arg *arg)
+ ny = selmon->wy;
+ else if (abs((selmon->wy + selmon->wh) - (ny + HEIGHT(c))) < snap)
+ ny = selmon->wy + selmon->wh - HEIGHT(c);
+- if (!c->isfloating && selmon->lt[selmon->sellt]->arrange
+- && (abs(nx - c->x) > snap || abs(ny - c->y) > snap))
+- togglefloating(NULL);
+ if (!selmon->lt[selmon->sellt]->arrange || c->isfloating)
+ resize(c, nx, ny, c->w, c->h, 1);
++ else if (selmon->lt[selmon->sellt]->arrange || !c->isfloating) {
++ if ((m = recttomon(ev.xmotion.x_root, ev.xmotion.y_root, 1, 1)) != selmon) {
++ sendmon(c, m);
++ selmon = m;
++ focus(NULL);
++ }
++
++ Client *cc = c->mon->clients;
++ while (1) {
++ if (cc == 0) break;
++ if(
++ cc != c && !cc->isfloating && ISVISIBLE(cc) &&
++ ev.xmotion.x_root > cc->x &&
++ ev.xmotion.x_root < cc->x + cc->w &&
++ ev.xmotion.y_root > cc->y &&
++ ev.xmotion.y_root < cc->y + cc->h ) {
++ break;
++ }
++
++ cc = cc->next;
++ }
++
++ if (cc) {
++ Client *cl1, *cl2, ocl1;
++
++ if (!selmon->lt[selmon->sellt]->arrange) return;
++
++ cl1 = c;
++ cl2 = cc;
++ ocl1 = *cl1;
++ strcpy(cl1->name, cl2->name);
++ cl1->win = cl2->win;
++ cl1->x = cl2->x;
++ cl1->y = cl2->y;
++ cl1->w = cl2->w;
++ cl1->h = cl2->h;
++
++ cl2->win = ocl1.win;
++ strcpy(cl2->name, ocl1.name);
++ cl2->x = ocl1.x;
++ cl2->y = ocl1.y;
++ cl2->w = ocl1.w;
++ cl2->h = ocl1.h;
++
++ selmon->sel = cl2;
++
++ c = cc;
++ focus(c);
++
++ arrange(cl1->mon);
++ }
++ }
+ break;
+ }
+ } while (ev.type != ButtonRelease);
+--
+2.43.0
+
diff --git a/dwm.suckless.org/patches/tiledmove/index.md b/dwm.suckless.org/patches/tiledmove/index.md
new file mode 100644
index 00000000..ac332aca
--- /dev/null
+++ b/dwm.suckless.org/patches/tiledmove/index.md
_AT_@ -0,0 +1,19 @@
+Tiledmove
+================
+
+Description
+-----------
+Patch to make the function `movemouse` not force clients to float.
+
+Tiled clients when moved will swap with other tiled clients that
+overlap with the cursor, and snap to other monitors.
+
+![](tiledmove.gif)
+
+Download
+--------
+* [dwm-tiledmove-20231210-b731.diff](dwm-tiledmove-20231210-b731.diff)
+
+Author
+-------
+* Niki - <schat_AT_cock.li>
diff --git a/dwm.suckless.org/patches/tiledmove/tiledmove.gif b/dwm.suckless.org/patches/tiledmove/tiledmove.gif
new file mode 100644
index 00000000..ebd92fb6
Binary files /dev/null and b/dwm.suckless.org/patches/tiledmove/tiledmove.gif differ
Received on Tue Dec 12 2023 - 19:23:04 CET

This archive was generated by hypermail 2.3.0 : Tue Dec 12 2023 - 19:24:47 CET