sites

public wiki contents of suckless.org
git clone git://git.suckless.org/sites
Log | Files | Refs

commit fcfc685bdfdba6095516f9df82121bd85bc44b82
parent 46f3a2cfe06fba98d15a35b9f04d9c9b36711321
Author: Miles Alan <m@milesalan.com>
Date:   Sat, 24 Aug 2019 22:59:10 -0500

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

Diffstat:
Adwm.suckless.org/patches/dragmfact/dwm-dragmfact-6.2.diff | 61+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
Adwm.suckless.org/patches/dragmfact/index.md | 17+++++++++++++++++
2 files changed, 78 insertions(+), 0 deletions(-)

diff --git a/dwm.suckless.org/patches/dragmfact/dwm-dragmfact-6.2.diff 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 <m@milesalan.com> +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 @@ -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 - <m@milesalan.com>