From 49c06840f664fcd77334f9439eee1b444da09328 Mon Sep 17 00:00:00 2001 From: nirav Date: Sun, 14 Jun 2020 17:23:16 +0000 Subject: Add attachbottom --- dwm.c | 19 ++++++++++++++++--- 1 file changed, 16 insertions(+), 3 deletions(-) (limited to 'dwm.c') diff --git a/dwm.c b/dwm.c index 2b96be8..abf9562 100644 --- a/dwm.c +++ b/dwm.c @@ -157,6 +157,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); @@ -436,6 +437,18 @@ attach(Client *c) c->mon->clients = c; } +void +attachbottom(Client *c) +{ + Client *below = c->mon->clients; + for (; below && below->next; below = below->next); + c->next = NULL; + if (below) + below->next = c; + else + c->mon->clients = c; +} + void attachstack(Client *c) { @@ -1253,7 +1266,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); @@ -1632,7 +1645,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); @@ -2195,7 +2208,7 @@ updategeom(void) m->clients = c->next; detachstack(c); c->mon = mons; - attach(c); + attachbottom(c); attachstack(c); } if (m == selmon) -- cgit v1.2.3