summaryrefslogtreecommitdiff
path: root/dwm/patches/dwm-tiledmove-20231210-b731.diff
diff options
context:
space:
mode:
authorTheSiahxyz <164138827+TheSiahxyz@users.noreply.github.com>2025-03-08 15:21:28 +0900
committerTheSiahxyz <164138827+TheSiahxyz@users.noreply.github.com>2025-03-08 15:21:28 +0900
commit4437d5b3c3eea76f6e2b0fd4a2ba21c02a098aeb (patch)
treee8dcb20bf144aacf88f93b012dccacdeb08015cd /dwm/patches/dwm-tiledmove-20231210-b731.diff
parentc2b06f0d5795a789f4ddab459179ff89aedfee98 (diff)
updates
Diffstat (limited to 'dwm/patches/dwm-tiledmove-20231210-b731.diff')
-rw-r--r--dwm/patches/dwm-tiledmove-20231210-b731.diff82
1 files changed, 82 insertions, 0 deletions
diff --git a/dwm/patches/dwm-tiledmove-20231210-b731.diff b/dwm/patches/dwm-tiledmove-20231210-b731.diff
new file mode 100644
index 0000000..8ede0c6
--- /dev/null
+++ b/dwm/patches/dwm-tiledmove-20231210-b731.diff
@@ -0,0 +1,82 @@
+# 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
+@@ -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