Apply attachbottom

This commit is contained in:
Franck STAUFFER 2020-09-04 09:57:20 +02:00
parent 100fed48d9
commit 52a87a26ad
Signed by: franck.stauffer
GPG Key ID: AAF5A94045CEC261

21
dwm.c
View File

@ -199,6 +199,8 @@ arrangemon(Monitor* m);
static void static void
attach(Client* c); attach(Client* c);
static void static void
attachbottom(Client* c);
static void
attachstack(Client* c); attachstack(Client* c);
static void static void
buttonpress(XEvent* e); buttonpress(XEvent* e);
@ -551,6 +553,19 @@ attach(Client* c)
c->mon->clients = 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 void
attachstack(Client* c) attachstack(Client* c)
{ {
@ -1281,7 +1296,7 @@ manage(Window w, XWindowAttributes* wa)
c->isfloating = c->oldstate = trans != None || c->isfixed; c->isfloating = c->oldstate = trans != None || c->isfixed;
if (c->isfloating) if (c->isfloating)
XRaiseWindow(dpy, c->win); XRaiseWindow(dpy, c->win);
attach(c); attachbottom(c);
attachstack(c); attachstack(c);
XChangeProperty(dpy, XChangeProperty(dpy,
root, root,
@ -1679,7 +1694,7 @@ sendmon(Client* c, Monitor* m)
detachstack(c); detachstack(c);
c->mon = m; c->mon = m;
c->tags = m->tagset[m->seltags]; /* assign tags of target monitor */ c->tags = m->tagset[m->seltags]; /* assign tags of target monitor */
attach(c); attachbottom(c);
attachstack(c); attachstack(c);
focus(NULL); focus(NULL);
arrange(NULL); arrange(NULL);
@ -2242,7 +2257,7 @@ updategeom(void)
m->clients = c->next; m->clients = c->next;
detachstack(c); detachstack(c);
c->mon = mons; c->mon = mons;
attach(c); attachbottom(c);
attachstack(c); attachstack(c);
} }
if (m == selmon) if (m == selmon)