about summary refs log tree commit diff stats
diff options
context:
space:
mode:
authorAcid Bong <acid-bong@cock.lt>2022-10-18 12:02:27 +0300
committerAcid Bong <acid-bong@cock.lt>2022-10-18 12:02:27 +0300
commitb696d507ea03fd5c88632e348700a8bcdc923c9e (patch)
treee27677d0145aa284b3fa6d2a8723b9c782b3ba06
parent292887ff6e3d2da3c56046591c5248cea2eadd1e (diff)
downloaddwm-b696d507ea03fd5c88632e348700a8bcdc923c9e.tar.gz
personal savefloats patch
-rw-r--r--patches/2-savefloats-20181212-b69c870.diff54
1 files changed, 54 insertions, 0 deletions
diff --git a/patches/2-savefloats-20181212-b69c870.diff b/patches/2-savefloats-20181212-b69c870.diff
new file mode 100644
index 0000000..77d4a3e
--- /dev/null
+++ b/patches/2-savefloats-20181212-b69c870.diff
@@ -0,0 +1,54 @@
+From 292887ff6e3d2da3c56046591c5248cea2eadd1e Mon Sep 17 00:00:00 2001
+From: Acid Bong <acid-bong@cock.lt>
+Date: Tue, 18 Oct 2022 11:59:44 +0300
+Subject: [PATCH] patch: savefloats
+
+---
+ dwm.c | 17 +++++++++++++++--
+ 1 file changed, 15 insertions(+), 2 deletions(-)
+
+diff --git a/dwm.c b/dwm.c
+index 02f3353..9780c41 100644
+--- a/dwm.c
++++ b/dwm.c
+@@ -88,6 +88,7 @@ struct Client {
+ 	char name[256];
+ 	float mina, maxa;
+ 	int x, y, w, h;
++	int sfx, sfy, sfw, sfh; /* stored float geometry, used on mode revert */
+ 	int oldx, oldy, oldw, oldh;
+ 	int basew, baseh, incw, inch, maxw, maxh, minw, minh, hintsvalid;
+ 	int bw, oldbw;
+@@ -1059,6 +1060,10 @@ manage(Window w, XWindowAttributes *wa)
+ 	updatewindowtype(c);
+ 	updatesizehints(c);
+ 	updatewmhints(c);
++	c->sfx = c->x;
++	c->sfy = c->y;
++	c->sfw = c->w;
++	c->sfh = c->h;
+ 	c->x = c->mon->mx + (c->mon->mw - WIDTH(c)) / 2;
+ 	c->y = c->mon->my + (c->mon->mh - HEIGHT(c)) / 2;
+ 	XSelectInput(dpy, w, EnterWindowMask|FocusChangeMask|PropertyChangeMask|StructureNotifyMask);
+@@ -1714,8 +1719,16 @@ togglefloating(const Arg *arg)
+ 		return;
+ 	selmon->sel->isfloating = !selmon->sel->isfloating || selmon->sel->isfixed;
+ 	if (selmon->sel->isfloating)
+-		resize(selmon->sel, selmon->sel->x, selmon->sel->y,
+-			selmon->sel->w, selmon->sel->h, 0);
++		/* restore last known float dimensions */
++		resize(selmon->sel, selmon->sel->sfx, selmon->sel->sfy,
++		       selmon->sel->sfw, selmon->sel->sfh, False);
++	else {
++		/* save last known float dimensions */
++		selmon->sel->sfx = selmon->sel->x;
++		selmon->sel->sfy = selmon->sel->y;
++		selmon->sel->sfw = selmon->sel->w;
++		selmon->sel->sfh = selmon->sel->h;
++	}
+ 	arrange(selmon);
+ }
+ 
+-- 
+2.38.0
+