Return to repo list

suckless-gf-dwm

Gentoo-friendly patches for Suckless's dwm.
Return to HMagellan.com

commit b9fc16b2beca5a139fb1aed60aa4f34d3911418b
parent b43d0ccb3a8e8804c65c6c38d975964245225276
Author: Erik Letson <hmagellan@hmagellan.com>
Date:   Thu, 13 Aug 2020 21:27:59 -0500

Added aspectresize

Diffstat:
MREADME | 2+-
Aaspectresize/USAGE | 59+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
Aaspectresize/aspectresize.patch | 43+++++++++++++++++++++++++++++++++++++++++++
3 files changed, 103 insertions(+), 1 deletion(-)

diff --git a/README b/README @@ -42,7 +42,7 @@ patches! (1). https://dwm.suckless.org/patches/ - CURRENT PROGRESS: 9/172 patches supported + CURRENT PROGRESS: 11/172 patches supported 1/172 patches unsupported USUPPORTED PATCHES: diff --git a/aspectresize/USAGE b/aspectresize/USAGE @@ -0,0 +1,59 @@ +aspectresize - Resize floating windows while maintaining their aspect ratio +Source: https://dwm.suckless.org/patches/aspectresize/dwm-aspectresize-6.2.diff +Original Author: Dhaval Patel - dhavalpatel32768@gmail.com + +Description from source: + """ + This patch you to resize the window with its aspect ratio remain constant, use moveresize patch for manual resize. + Usage + + Put the following aspectresize() function somewhere in your dwm.c, after the line which includes the config.h file: + + void + aspectresize(const Arg *arg) { + /* only floating windows can be moved */ + Client *c; + c = selmon->sel; + float ratio; + int w, h,nw, nh; + + if (!c || !arg) + return; + if (selmon->lt[selmon->sellt]->arrange && !c->isfloating) + return; + + ratio = (float)c->w / (float)c->h; + h = arg->i; + w = (int)(ratio * h); + + nw = c->w + w; + nh = c->h + h; + + XRaiseWindow(dpy, c->win); + resize(c, c->x, c->y, nw, nh, True); + } + + Add a aspectresize() function definition in dwm.c below the line: + + static void aspectresize(const Arg *arg); + + You can use Mod+Shift+j to increase size and Mod+Shift+k to decrease the size of client which respects client's aspect ratio: + + { MODKEY|ShiftMask, XK_j, aspectresize, {.i = +24} }, + { MODKEY|ShiftMask, XK_k, aspectresize, {.i = -24} }, + """ + +== YOU MUST == +(1). Place the patch file in /etc/portage/patches/x11-wm/dwm/ and run 'emerge dwm' + +== YOU PROBABLY SHOULD == +(1). Add some key bindings to increase or decrease the size of floating windows, for instance: + + { MODKEY|ShiftMask, XK_j, aspectresize, {.i = +24} }, + { MODKEY|ShiftMask, XK_k, aspectresize, {.i = -24} }, + +== PATCH MODIFICATIONS == +(1). Removed lines relating to config.def.h + +== INCOMPATIBILITIES == +No known specific incompatibilities. diff --git a/aspectresize/aspectresize.patch b/aspectresize/aspectresize.patch @@ -0,0 +1,43 @@ +diff --git a/dwm.c b/dwm.c +index 9fd0286..6a02119 100644 +--- a/dwm.c ++++ b/dwm.c +@@ -146,6 +146,7 @@ static void applyrules(Client *c); + static int applysizehints(Client *c, int *x, int *y, int *w, int *h, int interact); + static void arrange(Monitor *m); + static void arrangemon(Monitor *m); ++static void aspectresize(const Arg *arg); + static void attach(Client *c); + static void attachstack(Client *c); + static void buttonpress(XEvent *e); +@@ -400,6 +401,30 @@ arrangemon(Monitor *m) + m->lt[m->sellt]->arrange(m); + } + ++void ++aspectresize(const Arg *arg) { ++ /* only floating windows can be moved */ ++ Client *c; ++ c = selmon->sel; ++ float ratio; ++ int w, h,nw, nh; ++ ++ if (!c || !arg) ++ return; ++ if (selmon->lt[selmon->sellt]->arrange && !c->isfloating) ++ return; ++ ++ ratio = (float)c->w / (float)c->h; ++ h = arg->i; ++ w = (int)(ratio * h); ++ ++ nw = c->w + w; ++ nh = c->h + h; ++ ++ XRaiseWindow(dpy, c->win); ++ resize(c, c->x, c->y, nw, nh, True); ++} ++ + void + attach(Client *c) + {