From 52a87a26ade6f10640aa706014b342f41062b9ad Mon Sep 17 00:00:00 2001 From: Franck STAUFFER Date: Fri, 4 Sep 2020 09:57:20 +0200 Subject: [PATCH] Apply attachbottom --- dwm.c | 21 ++++++++++++++++++--- 1 file changed, 18 insertions(+), 3 deletions(-) diff --git a/dwm.c b/dwm.c index 775c8f0..cbc0e24 100644 --- a/dwm.c +++ b/dwm.c @@ -199,6 +199,8 @@ arrangemon(Monitor* m); static void attach(Client* c); static void +attachbottom(Client* c); +static void attachstack(Client* c); static void buttonpress(XEvent* e); @@ -551,6 +553,19 @@ attach(Client* c) c->mon->clients = c; } +void +attachbottom(Client* c) +{ + c->next = NULL; + Client* below = c->mon->clients; + if (below) { + for(; below->next; below = below->next); + below->next = c; + } + else + c->mon->clients = c; +} + void attachstack(Client* c) { @@ -1281,7 +1296,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, @@ -1679,7 +1694,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); @@ -2242,7 +2257,7 @@ updategeom(void) m->clients = c->next; detachstack(c); c->mon = mons; - attach(c); + attachbottom(c); attachstack(c); } if (m == selmon)