diff --git a/.config/dwm/dwm.c b/.config/dwm/dwm.c index 346475b..b39267d 100644 --- a/.config/dwm/dwm.c +++ b/.config/dwm/dwm.c @@ -895,6 +895,7 @@ static int applysizehints( 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); @@ -1573,6 +1574,13 @@ void 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; +} + /* This inserts a client at the top of the monitor's stacking order. * * The stacking order is a linked list of client structures where one client @@ -3960,7 +3968,7 @@ void manage(Window w, XWindowAttributes *wa) { if (c->isfloating) XRaiseWindow(dpy, c->win); /* Add the client to the client list. New clients are always added at the top * of the list making them the new master client. */ - attach(c); + attachbottom(c); /* Add the client to the stacking order list. New additions are always added * at the top of the list to indicate order in which clients had focus. */ attachstack(c); @@ -4386,7 +4394,7 @@ void pop(Client *c) { * stack (list of clients) and adds it again at the start of the list making * it the new master window. */ detach(c); - attach(c); + attachbottom(c); focus(c); /* Make sure the given window has input focus */ arrange(c->mon); /* Rearrange all tiled windows as the order has changed */ } @@ -5073,7 +5081,7 @@ void sendmon(Client *c, Monitor *m) { * viewed tags on that monitor. */ c->tags = m->tagset[m->seltags]; /* assign tags of target monitor */ /* Add the client to the target monitor's client list. */ - attach(c); + attachbottom(c); /* Add the client to the target monitor's stacking order list. */ attachstack(c); diff --git a/.config/dwm/patches/dwm-attachbottom-6.3.diff b/.config/dwm/patches/dwm-attachbottom-6.3.diff new file mode 100644 index 0000000..10e70ee --- /dev/null +++ b/.config/dwm/patches/dwm-attachbottom-6.3.diff @@ -0,0 +1,54 @@ +diff -up dwm-6.3/dwm.c dwm-6.3-attachbottom/dwm.c +--- dwm-6.3/dwm.c 2022-01-07 12:42:18.000000000 +0100 ++++ dwm-6.3-attachbottom/dwm.c 2022-08-17 22:14:41.813809073 +0200 +@@ -147,6 +147,7 @@ static int applysizehints(Client *c, int + 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); +@@ -408,6 +409,15 @@ attach(Client *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) + { + c->snext = c->mon->stack; +@@ -1066,7 +1076,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); +@@ -1421,7 +1431,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); +@@ -1903,7 +1913,7 @@ updategeom(void) + m->clients = c->next; + detachstack(c); + c->mon = mons; +- attach(c); ++ attachbottom(c); + attachstack(c); + } + if (m == selmon) \ No newline at end of file