From 01674e4a2b4d2ca45d2a6ee5bb7a1d94d81cc9af Mon Sep 17 00:00:00 2001 From: frosty Date: Wed, 4 Sep 2024 00:03:19 -0400 Subject: [PATCH] patch: attachbottom --- dwm.c | 16 +++++++++++++--- 1 file changed, 13 insertions(+), 3 deletions(-) diff --git a/dwm.c b/dwm.c index 76f0768..4c72ecc 100644 --- a/dwm.c +++ b/dwm.c @@ -149,6 +149,7 @@ static int applysizehints(Client *c, int *x, int *y, int *w, int *h, int interac static void arrange(Monitor *m); static void arrangemon(Monitor *m); static void attach(Client *c); +static void attachbottom(Client *c); static void attachstack(Client *c); static void buttonpress(XEvent *e); static void checkotherwm(void); @@ -419,6 +420,15 @@ attach(Client *c) c->mon->clients = c; } +void +attachbottom(Client *c) +{ + Client **tc; + c->next = NULL; + for (tc = &c->mon->clients; *tc; tc = &(*tc)->next); + *tc = c; +} + void attachstack(Client *c) { @@ -1103,7 +1113,7 @@ manage(Window w, XWindowAttributes *wa) c->isfloating = c->oldstate = trans != None || c->isfixed; if (c->isfloating) XRaiseWindow(dpy, c->win); - attach(c); + attachbottom(c); attachstack(c); XChangeProperty(dpy, root, netatom[NetClientList], XA_WINDOW, 32, PropModeAppend, (unsigned char *) &(c->win), 1); @@ -1456,7 +1466,7 @@ sendmon(Client *c, Monitor *m) detachstack(c); c->mon = m; c->tags = m->tagset[m->seltags]; /* assign tags of target monitor */ - attach(c); + attachbottom(c); attachstack(c); focus(NULL); arrange(NULL); @@ -1972,7 +1982,7 @@ updategeom(void) m->clients = c->next; detachstack(c); c->mon = mons; - attach(c); + attachbottom(c); attachstack(c); } if (m == selmon)