commit 499745ff29f8b170670d6feb35f2be71ab6c2adf
parent ed985efba0d6debc9db7f808c3b870be0db630c4
Author: Jan Christoph Ebersbach <jceb@e-jc.de>
Date: Sun, 9 Feb 2014 19:47:22 +0100
update attachabove patch
Diffstat:
2 files changed, 66 insertions(+), 1 deletion(-)
diff --git a/dwm.suckless.org/patches/attachabove.md b/dwm.suckless.org/patches/attachabove.md
@@ -9,8 +9,9 @@ always becoming the new master) - basically how Xmonad does it.
Download
--------
Patches against different versions of dwm are available at
-[dwm-clean-patches](https://bitbucket.org/jceb81/dwm-clean-patches/src).
+[dwm-clean-patches](https://github.com/jceb/dwm-clean-patches).
+ * [dwm-6.1-attachabove.diff](dwm-6.1-attachabove.diff) (1786b) (20140209)
* [dwm-10e232f9ace7-attachabove.diff](dwm-10e232f9ace7-attachabove.diff) (1709b) (20120406)
* [dwm-6.0-attachabove.diff](dwm-6.0-attachabove.diff) (1707b) (20120406)
* [dwm-5.6.1-attachabove.diff](dwm-5.6.1-attachabove.diff) (1.1K) (20090817)
diff --git a/dwm.suckless.org/patches/dwm-6.1-attachabove.diff b/dwm.suckless.org/patches/dwm-6.1-attachabove.diff
@@ -0,0 +1,64 @@
+Author: Jan Christoph Ebersbach <jceb@e-jc.de>
+URL: http://dwm.suckless.org/patches/attachabove
+attachabove makes new clients attach above the selected client (instead of
+always becoming the new master) – basically how Xmonad does it.
+
+Index: dwm/dwm.c
+===================================================================
+--- dwm/dwm.c.orig 2014-02-09 15:24:20.560117200 +0100
++++ dwm/dwm.c 2014-02-09 15:24:20.552117200 +0100
+@@ -146,6 +146,7 @@
+ static void arrange(Monitor *m);
+ static void arrangemon(Monitor *m);
+ static void attach(Client *c);
++static void attachabove(Client *c);
+ static void attachstack(Client *c);
+ static void buttonpress(XEvent *e);
+ static void checkotherwm(void);
+@@ -401,6 +402,19 @@
+ }
+
+ void
++attachabove(Client *c) {
++ if(c->mon->sel == NULL || c->mon->sel == c->mon->clients || c->mon->sel->isfloating) {
++ attach(c);
++ return;
++ }
++
++ Client *at;
++ for(at = c->mon->clients; at->next != c->mon->sel; at = at->next);
++ c->next = at->next;
++ at->next = c;
++}
++
++void
+ attachstack(Client *c) {
+ c->snext = c->mon->stack;
+ c->mon->stack = c;
+@@ -1051,7 +1065,7 @@
+ c->isfloating = c->oldstate = trans != None || c->isfixed;
+ if(c->isfloating)
+ XRaiseWindow(dpy, c->win);
+- attach(c);
++ attachabove(c);
+ attachstack(c);
+ XChangeProperty(dpy, root, netatom[NetClientList], XA_WINDOW, 32, PropModeAppend,
+ (unsigned char *) &(c->win), 1);
+@@ -1383,7 +1397,7 @@
+ detachstack(c);
+ c->mon = m;
+ c->tags = m->tagset[m->seltags]; /* assign tags of target monitor */
+- attach(c);
++ attachabove(c);
+ attachstack(c);
+ focus(NULL);
+ arrange(NULL);
+@@ -1818,7 +1832,7 @@
+ m->clients = c->next;
+ detachstack(c);
+ c->mon = mons;
+- attach(c);
++ attachabove(c);
+ attachstack(c);
+ }
+ if(m == selmon)