commit 8597c80a2a1118640796c7ed2e3fe2db4502cbff
parent 5cc3897d4e8050f9a5919990cba504a1e4491e1b
Author: Szabolcs Szucs <contact@szabolcsszucs.com>
Date: Sat, 26 Dec 2020 21:50:19 +0100
[dwm][patch][attachbottom] denser implementation
Accidental reimplementation with `detach` as reference algorithm, using `Client**`.
As discussed with Marshall, I'm hereby updating the patch.
Diffstat:
3 files changed, 85 insertions(+), 33 deletions(-)
diff --git a/dwm.suckless.org/patches/attachbottom/dwm-attachbottom-20201227-61bb8b2.diff b/dwm.suckless.org/patches/attachbottom/dwm-attachbottom-20201227-61bb8b2.diff
@@ -0,0 +1,67 @@
+From eea05f94baf707114ea882e8755520ba30d73cb2 Mon Sep 17 00:00:00 2001
+From: Szabolcs Szucs <contact@szabolcsszucs.com>
+Date: Sat, 26 Dec 2020 21:17:40 +0100
+Subject: [PATCH] attachbottom patch
+
+---
+ dwm.c | 16 +++++++++++++---
+ 1 file changed, 13 insertions(+), 3 deletions(-)
+
+diff --git a/dwm.c b/dwm.c
+index 664c527..7ee3566 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,15 @@ 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;
++}
++
+ void
+ attachstack(Client *c)
+ {
+@@ -1063,7 +1073,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);
+@@ -1418,7 +1428,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);
+@@ -1900,7 +1910,7 @@ updategeom(void)
+ m->clients = c->next;
+ detachstack(c);
+ c->mon = mons;
+- attach(c);
++ attachbottom(c);
+ attachstack(c);
+ }
+ if (m == selmon)
+--
+2.29.2
+
diff --git a/dwm.suckless.org/patches/attachbottom/dwm-attachbottom-6.2.diff b/dwm.suckless.org/patches/attachbottom/dwm-attachbottom-6.2.diff
@@ -1,18 +1,7 @@
-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
+diff -up dwm-6.2/dwm.c dwm-6.2-attachbottom/dwm.c
+--- dwm-6.2/dwm.c 2019-02-02 13:55:28.000000000 +0100
++++ dwm-6.2-attachbottom/dwm.c 2020-12-27 10:43:35.956867775 +0100
+@@ -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);
@@ -20,26 +9,23 @@ index 4465af1..bf13d15 100644
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;
+@@ -407,6 +408,15 @@ attach(Client *c)
}
-+void
+ void
+attachbottom(Client *c)
+{
-+ Client *below = c->mon->clients;
-+ for (; below && below->next; below = below->next);
++ Client **tc;
+ c->next = NULL;
-+ if (below)
-+ below->next = c;
-+ else
-+ c->mon->clients = c;
++ for (tc = &c->mon->clients; *tc; tc = &(*tc)->next);
++ *tc = c;
+}
+
- void
++void
attachstack(Client *c)
{
-@@ -1062,7 +1075,7 @@ manage(Window w, XWindowAttributes *wa)
+ c->snext = c->mon->stack;
+@@ -1062,7 +1072,7 @@ manage(Window w, XWindowAttributes *wa)
c->isfloating = c->oldstate = trans != None || c->isfixed;
if (c->isfloating)
XRaiseWindow(dpy, c->win);
@@ -48,7 +34,7 @@ index 4465af1..bf13d15 100644
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)
+@@ -1417,7 +1427,7 @@ sendmon(Client *c, Monitor *m)
detachstack(c);
c->mon = m;
c->tags = m->tagset[m->seltags]; /* assign tags of target monitor */
@@ -57,7 +43,7 @@ index 4465af1..bf13d15 100644
attachstack(c);
focus(NULL);
arrange(NULL);
-@@ -1897,7 +1910,7 @@ updategeom(void)
+@@ -1897,7 +1907,7 @@ updategeom(void)
m->clients = c->next;
detachstack(c);
c->mon = mons;
@@ -66,6 +52,3 @@ index 4465af1..bf13d15 100644
attachstack(c);
}
if (m == selmon)
---
-2.17.1
-
diff --git a/dwm.suckless.org/patches/attachbottom/index.md b/dwm.suckless.org/patches/attachbottom/index.md
@@ -5,13 +5,15 @@ Description
-----------
New clients attach at the bottom of the stack instead of the top.
-I find this to be the least obtrusive attachment behavior, since no existing
+Some users find this to be a less obtrusive attachment behavior, since no existing
clients are ever moved, only resized.
Download
--------
* [dwm-attachbottom-6.2.diff](dwm-attachbottom-6.2.diff)
+* [dwm-attachbottom-20201226-61bb8b2.diff](dwm-attachbottom-20201226-61bb8b2.diff)
Authors
-------
-* Marshall Mason - `<marshallmason2@gmail.com>`
+* Marshall Mason - `<marshallmason2@gmail.com>` (not using dwm anymore)
+* Szabolcs Szucs - `<contact@szabolcsszucs.com>`