summaryrefslogtreecommitdiffhomepage
path: root/patch/aspectresize.c
diff options
context:
space:
mode:
authorbakkeby <[email protected]>2020-08-27 07:34:21 +0200
committerbakkeby <[email protected]>2020-08-27 07:34:21 +0200
commitb3d336322e56637c7e157a44695dab6def2fcb05 (patch)
tree6a64e4bf744bdbcd01eeccdaa00c5281403014be /patch/aspectresize.c
parent376b48e4d21258e6de5e8da014e555aca399703b (diff)
downloaddwm-flexipatch-b3d336322e56637c7e157a44695dab6def2fcb05.tar.gz
dwm-flexipatch-b3d336322e56637c7e157a44695dab6def2fcb05.zip
Adding aspectresize patch
Diffstat (limited to 'patch/aspectresize.c')
-rw-r--r--patch/aspectresize.c24
1 files changed, 24 insertions, 0 deletions
diff --git a/patch/aspectresize.c b/patch/aspectresize.c
new file mode 100644
index 0000000..73a0342
--- /dev/null
+++ b/patch/aspectresize.c
@@ -0,0 +1,24 @@
+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);
+} \ No newline at end of file