aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
Diffstat (limited to '')
-rw-r--r--README1
-rw-r--r--README.org1
-rw-r--r--dwm.c17
3 files changed, 17 insertions, 2 deletions
diff --git a/README b/README
index 0bffd1f..7876e76 100644
--- a/README
+++ b/README
@@ -65,6 +65,7 @@ List of patches in use:
- nodmenu
- pertag
- restartsig
+ - savefloats
- sizehints
- switchtotag
- tagothermon
diff --git a/README.org b/README.org
index 82a6fb5..343e089 100644
--- a/README.org
+++ b/README.org
@@ -62,6 +62,7 @@ List of patches in use:
- /nodmenu/
- /pertag/
- /restartsig/
+- /savefloats/
- /sizehints/
- /switchtotag/
- /tagothermon/
diff --git a/dwm.c b/dwm.c
index 0b9cc8c..b27f725 100644
--- a/dwm.c
+++ b/dwm.c
@@ -89,6 +89,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;
int bw, oldbw;
@@ -1108,6 +1109,10 @@ manage(Window w, XWindowAttributes *wa)
updatewmhints(c);
c->x = c->mon->mx + (c->mon->mw - WIDTH(c)) / 2;
c->y = c->mon->my + (c->mon->mh - HEIGHT(c)) / 2;
+ c->sfx = c->x;
+ c->sfy = c->y;
+ c->sfw = c->w;
+ c->sfh = c->h;
XSelectInput(dpy, w, EnterWindowMask|FocusChangeMask|PropertyChangeMask|StructureNotifyMask);
grabbuttons(c, 0);
if (!c->isfloating)
@@ -1964,8 +1969,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);
}