aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authornirav <nirav@airmail.cc>2020-06-14 17:23:16 +0000
committernirav <nirav@airmail.cc>2020-06-14 17:23:16 +0000
commit49c06840f664fcd77334f9439eee1b444da09328 (patch)
tree72070fe84ad65ee59f95ed66b2187ef0600e53d8
parent76e037a07350a299e5281dd8ad0c4b2d30ae7667 (diff)
downloaddwm-49c06840f664fcd77334f9439eee1b444da09328.tar.gz
dwm-49c06840f664fcd77334f9439eee1b444da09328.zip
Add attachbottom
-rw-r--r--README1
-rw-r--r--dwm.c19
2 files changed, 17 insertions, 3 deletions
diff --git a/README b/README
index d70f97d..f4c5a24 100644
--- a/README
+++ b/README
@@ -56,3 +56,4 @@ scratchpad - https://dwm.suckless.org/patches/scratchpad/
movestack - https://dwm.suckless.org/patches/movestack/
dragmfact - https://dwm.suckless.org/patches/dragmfact/
tab - https://dwm.suckless.org/patches/tab/
+attachbottom - https://dwm.suckless.org/patches/attachbottom/
diff --git a/dwm.c b/dwm.c
index 2b96be8..abf9562 100644
--- a/dwm.c
+++ b/dwm.c
@@ -157,6 +157,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);
@@ -437,6 +438,18 @@ attach(Client *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)
{
c->snext = c->mon->stack;
@@ -1253,7 +1266,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);
@@ -1632,7 +1645,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);
@@ -2195,7 +2208,7 @@ updategeom(void)
m->clients = c->next;
detachstack(c);
c->mon = mons;
- attach(c);
+ attachbottom(c);
attachstack(c);
}
if (m == selmon)