You cannot select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
patches/dwm/dwm-attachbottom-6.3.diff

72 lines
1.8 KiB
Diff

From 2b0aa06acb2ce04d8761cfd993adf069e9abb9ab Mon Sep 17 00:00:00 2001
From: Bakkeby <bakkeby@gmail.com>
Date: Mon, 10 Jan 2022 11:11:00 +0100
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 a96f33c..15b0138 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);
@@ -407,6 +408,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)
{
@@ -1066,7 +1079,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 +1434,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 +1916,7 @@ updategeom(void)
m->clients = c->next;
detachstack(c);
c->mon = mons;
- attach(c);
+ attachbottom(c);
attachstack(c);
}
if (m == selmon)
--
2.19.1