commit fcfc685bdfdba6095516f9df82121bd85bc44b82
Author: Miles Alan <[email protected]>
Date:   Sat Aug 24 22:59:10 2019 -0500

    [dwm][patch] dragmfact: Add patch; allows resize mfact by mod + dragging 
mouse

diff --git a/dwm.suckless.org/patches/dragmfact/dwm-dragmfact-6.2.diff 
b/dwm.suckless.org/patches/dragmfact/dwm-dragmfact-6.2.diff
new file mode 100644
index 00000000..988c803c
--- /dev/null
+++ b/dwm.suckless.org/patches/dragmfact/dwm-dragmfact-6.2.diff
@@ -0,0 +1,61 @@
+From ddfeb46e2d7767a37bb64b135f81555846096341 Mon Sep 17 00:00:00 2001
+From: Miles Alan <[email protected]>
+Date: Sat, 24 Aug 2019 22:33:01 -0500
+Subject: [PATCH] dragmfact: Mod + right click / drag in tiling to resize mfact
+
+---
+ dwm.c | 26 +++++++++++++++++---------
+ 1 file changed, 17 insertions(+), 9 deletions(-)
+
+diff --git a/dwm.c b/dwm.c
+index 4465af1..650935a 100644
+--- a/dwm.c
++++ b/dwm.c
+@@ -1306,7 +1306,13 @@ resizemouse(const Arg *arg)
+       if (XGrabPointer(dpy, root, False, MOUSEMASK, GrabModeAsync, 
GrabModeAsync,
+               None, cursor[CurResize]->cursor, CurrentTime) != GrabSuccess)
+               return;
+-      XWarpPointer(dpy, None, c->win, 0, 0, 0, 0, c->w + c->bw - 1, c->h + 
c->bw - 1);
++
++      if (c->isfloating || NULL == c->mon->lt[c->mon->sellt]->arrange) {
++              XWarpPointer(dpy, None, c->win, 0, 0, 0, 0, c->w + c->bw - 1, 
c->h + c->bw - 1);
++      } else {
++              XWarpPointer(dpy, None, root, 0, 0, 0, 0, selmon->mw * 
selmon->mfact, selmon->mh / 2);
++      }
++
+       do {
+               XMaskEvent(dpy, 
MOUSEMASK|ExposureMask|SubstructureRedirectMask, &ev);
+               switch(ev.type) {
+@@ -1322,19 +1328,21 @@ resizemouse(const Arg *arg)
+ 
+                       nw = MAX(ev.xmotion.x - ocx - 2 * c->bw + 1, 1);
+                       nh = MAX(ev.xmotion.y - ocy - 2 * c->bw + 1, 1);
+-                      if (c->mon->wx + nw >= selmon->wx && c->mon->wx + nw <= 
selmon->wx + selmon->ww
+-                      && c->mon->wy + nh >= selmon->wy && c->mon->wy + nh <= 
selmon->wy + selmon->wh)
+-                      {
+-                              if (!c->isfloating && 
selmon->lt[selmon->sellt]->arrange
+-                              && (abs(nw - c->w) > snap || abs(nh - c->h) > 
snap))
+-                                      togglefloating(NULL);
+-                      }
++
+                       if (!selmon->lt[selmon->sellt]->arrange || 
c->isfloating)
+                               resize(c, c->x, c->y, nw, nh, 1);
+                       break;
+               }
+       } while (ev.type != ButtonRelease);
+-      XWarpPointer(dpy, None, c->win, 0, 0, 0, 0, c->w + c->bw - 1, c->h + 
c->bw - 1);
++
++      if (c->isfloating || NULL == c->mon->lt[c->mon->sellt]->arrange) {
++              XWarpPointer(dpy, None, c->win, 0, 0, 0, 0, c->w + c->bw - 1, 
c->h + c->bw - 1);
++      } else {
++              selmon->mfact = (double) ev.xmotion.x / (double) selmon->mw;
++              arrange(selmon);
++              XWarpPointer(dpy, None, root, 0, 0, 0, 0, selmon->mw * 
selmon->mfact, selmon->mh / 2);
++      }
++
+       XUngrabPointer(dpy, CurrentTime);
+       while (XCheckMaskEvent(dpy, EnterWindowMask, &ev));
+       if ((m = recttomon(c->x, c->y, c->w, c->h)) != selmon) {
+-- 
+2.19.2
+
diff --git a/dwm.suckless.org/patches/dragmfact/index.md 
b/dwm.suckless.org/patches/dragmfact/index.md
new file mode 100644
index 00000000..5d9297d5
--- /dev/null
+++ b/dwm.suckless.org/patches/dragmfact/index.md
@@ -0,0 +1,17 @@
+dragmfact
+===========
+
+Description
+-----------
+This patch lets you resize the split in the tile layout (e.g. modify mfact) by 
holding the modkey and dragging the mouse.
+
+This behavior is similar to the way i3 handles resizing tiling splits.
+
+
+Download
+--------
+* [dwm-dragmfact-6.2.diff](dwm-dragmfact-6.2.diff)
+
+Authors
+-------
+* Miles Alan - <[email protected]>


Reply via email to