mirror of
https://github.com/donovanglover/nix-config.git
synced 2024-11-24 09:13:09 +01:00
dwm: Add save floats patch
Now it's possible to float and unfloat windows and those windows will preserve their floating window size. Note that this patch was merged with the alwayscenter patch so the diff applies cleanly.
This commit is contained in:
parent
078fd93168
commit
d567a56b4d
44
assets/dwm-savefloats-alwayscenter.patch
Normal file
44
assets/dwm-savefloats-alwayscenter.patch
Normal file
@ -0,0 +1,44 @@
|
||||
diff --git a/dwm.c b/dwm.c
|
||||
index 67c6b2b..ed46374 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;
|
||||
@@ -1068,6 +1069,12 @@ manage(Window w, XWindowAttributes *wa)
|
||||
updatewindowtype(c);
|
||||
updatesizehints(c);
|
||||
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)
|
||||
@@ -1730,8 +1737,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);
|
||||
}
|
||||
|
@ -256,17 +256,13 @@ in
|
||||
../assets/dwm-adjacenttag.patch
|
||||
../assets/dwm-remove-layout-indicator.patch
|
||||
../assets/dwm-remove-floating-indicator.patch
|
||||
../assets/dwm-savefloats-alwayscenter.patch
|
||||
|
||||
(pkgs.fetchpatch {
|
||||
url = "https://dwm.suckless.org/patches/hide_vacant_tags/dwm-hide_vacant_tags-6.4.diff";
|
||||
hash = "sha256-GIbRW0Inwbp99rsKLfIDGvPwZ3pqihROMBp5vFlHx5Q=";
|
||||
})
|
||||
|
||||
(pkgs.fetchpatch {
|
||||
url = "https://dwm.suckless.org/patches/alwayscenter/dwm-alwayscenter-20200625-f04cac6.diff";
|
||||
hash = "sha256-xQEwrNphaLOkhX3ER09sRPB3EEvxC73oNWMVkqo4iSY=";
|
||||
})
|
||||
|
||||
(pkgs.fetchpatch {
|
||||
url = "https://dwm.suckless.org/patches/alpha/dwm-alpha-20230401-348f655.diff";
|
||||
hash = "sha256-ZhuqyDpY+nQQgrjniQ9DNheUgE9o/MUXKaJYRU3Uyl4=";
|
||||
|
Loading…
Reference in New Issue
Block a user