diff --git a/assets/dwm-savefloats-alwayscenter.patch b/assets/dwm-savefloats-alwayscenter.patch new file mode 100644 index 00000000..9420d266 --- /dev/null +++ b/assets/dwm-savefloats-alwayscenter.patch @@ -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); + } + diff --git a/specializations/dwm.nix b/specializations/dwm.nix index cb1bc8ab..560694b7 100644 --- a/specializations/dwm.nix +++ b/specializations/dwm.nix @@ -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=";