diff --git a/README.md b/README.md index 4734a43..3fb64f9 100644 --- a/README.md +++ b/README.md @@ -60,4 +60,5 @@ Most patches can be found on the suckless website: [https://dwm.suckless.org/pat * [anybar](https://github.com/mihirlad55/dwm-anybar) (Polybar Tray Fix Version) - Enables dwm to manage external status bars such as lemonbar and polybar * [aspectresize](https://dwm.suckless.org/patches/aspectresize/) - Allows you to resize a window while maintaining aspect ratio * [attachbelow](https://dwm.suckless.org/patches/attachbelow/) (Toggleable) - Make new clients attach below the selected client, instead of always becoming the new master +* [autoresize](https://dwm.suckless.org/patches/autoresize/) - Windows that are not visible when requesting a resize/move will get resized/moved * [fixborders](https://dwm.suckless.org/patches/alpha/) - Make borders opaque diff --git a/dwm.c b/dwm.c index ef05569..6275921 100644 --- a/dwm.c +++ b/dwm.c @@ -92,7 +92,7 @@ struct Client { int basew, baseh, incw, inch, maxw, maxh, minw, minh; int bw, oldbw; unsigned int tags; - int isfixed, isfloating, isurgent, neverfocus, oldstate, isfullscreen; + int isfixed, isfloating, isurgent, neverfocus, oldstate, isfullscreen, needresize; Client *next; Client *snext; Monitor *mon; @@ -672,6 +672,8 @@ configurerequest(XEvent *e) configure(c); if (ISVISIBLE(c)) XMoveResizeWindow(dpy, c->win, c->x, c->y, c->w, c->h); + else + c->needresize = 1; } else configure(c); } else { @@ -1760,6 +1762,12 @@ showhide(Client *c) if (ISVISIBLE(c)) { /* show clients top down */ XMoveWindow(dpy, c->win, c->x, c->y); + if (c->needresize) { + c->needresize = 0; + XMoveResizeWindow(dpy, c->win, c->x, c->y, c->w, c->h); + } else { + XMoveWindow(dpy, c->win, c->x, c->y); + } if ((!c->mon->lt[c->mon->sellt]->arrange || c->isfloating) && !c->isfullscreen) resize(c, c->x, c->y, c->w, c->h, 0); showhide(c->snext); diff --git a/patches/dwm-autoresize-6.1.diff b/patches/dwm-autoresize-6.1.diff new file mode 100644 index 0000000..76530b9 --- /dev/null +++ b/patches/dwm-autoresize-6.1.diff @@ -0,0 +1,35 @@ +diff --git a/dwm.c b/dwm.c +index 0362114..e4e8514 100644 +--- a/dwm.c ++++ b/dwm.c +@@ -92,7 +92,7 @@ struct Client { + int basew, baseh, incw, inch, maxw, maxh, minw, minh; + int bw, oldbw; + unsigned int tags; +- int isfixed, isfloating, isurgent, neverfocus, oldstate, isfullscreen; ++ int isfixed, isfloating, isurgent, neverfocus, oldstate, isfullscreen, needresize; + Client *next; + Client *snext; + Monitor *mon; +@@ -621,6 +621,8 @@ configurerequest(XEvent *e) + configure(c); + if (ISVISIBLE(c)) + XMoveResizeWindow(dpy, c->win, c->x, c->y, c->w, c->h); ++ else ++ c->needresize = 1; + } else + configure(c); + } else { +@@ -1611,6 +1613,12 @@ showhide(Client *c) + if (ISVISIBLE(c)) { + /* show clients top down */ + XMoveWindow(dpy, c->win, c->x, c->y); ++ if (c->needresize) { ++ c->needresize = 0; ++ XMoveResizeWindow(dpy, c->win, c->x, c->y, c->w, c->h); ++ } else { ++ XMoveWindow(dpy, c->win, c->x, c->y); ++ } + if ((!c->mon->lt[c->mon->sellt]->arrange || c->isfloating) && !c->isfullscreen) + resize(c, c->x, c->y, c->w, c->h, 0); + showhide(c->snext);