2
0
mirror of https://github.com/bakkeby/patches synced 2024-11-05 21:20:30 +00:00
patches/dwm/dwm-attachbottom-6.2.diff
2020-04-23 10:32:53 +02:00

72 lines
1.8 KiB
Diff

From 5db9b0d2860948ff42cbdae4031c90b3aa9c7d2f Mon Sep 17 00:00:00 2001
From: bakkeby <bakkeby@gmail.com>
Date: Thu, 23 Apr 2020 10:06:18 +0200
Subject: [PATCH] attachbottom patch
New clients attach at the bottom of the stack instead of the top.
---
dwm.c | 19 ++++++++++++++++---
1 file changed, 16 insertions(+), 3 deletions(-)
diff --git a/dwm.c b/dwm.c
index 4465af1..bf13d15 100644
--- a/dwm.c
+++ b/dwm.c
@@ -147,6 +147,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);
@@ -406,6 +407,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)
{
@@ -1062,7 +1075,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);
@@ -1417,7 +1430,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);
@@ -1897,7 +1910,7 @@ updategeom(void)
m->clients = c->next;
detachstack(c);
c->mon = mons;
- attach(c);
+ attachbottom(c);
attachstack(c);
}
if (m == selmon)
--
2.17.1