commit 672d0020cc076da4eec5f5e106ab97a367f666af
parent abb476392fe5de4199cb6132d05ec94056c9237c
Author: Erik Letson <hmagellan@hmagellan.com>
Date: Thu, 13 Aug 2020 21:55:00 -0500
Added attachaside
Diffstat:
3 files changed, 148 insertions(+), 2 deletions(-)
diff --git a/README b/README
@@ -42,12 +42,12 @@ patches!
(1). https://dwm.suckless.org/patches/
- CURRENT PROGRESS: 12/172 patches supported
+ CURRENT PROGRESS: 13/172 patches supported
1/172 patches unsupported
USUPPORTED PATCHES:
(1). alpha - https://dwm.suckless.org/patches/alpha/
- |-Makes changes to config.mk that I haven't been able to successfully port yet
+ |-Makes changes to config.mk that haven't been successfully ported yet
NOTE THAT UNSUPPORTED PATCHES SHOULD BE SUPPORTED IN THE FUTURE!!!
diff --git a/attachaside/USAGE b/attachaside/USAGE
@@ -0,0 +1,54 @@
+attachaside - Spawn new windows to the side of the current master window
+Source: https://dwm.suckless.org/patches/attachaside/dwm-attachaside-20180126-db22360.diff
+Original Authors: Jerome Andrieux - jerome@gcu.info
+ Chris Down - chris@chrisdown.name (6.1 port and fixes)
+ Laslo Hunhold - dev@frign.de (git port)
+
+Description from source:
+ """
+ Make new clients get attached and focused in the stacking area instead of always becoming the new master. It's basically an attachabove modification.
+
+ Original behaviour :
+ +-----------------+-------+
+ | | |
+ | | P |
+ | | |
+ | N +-------+
+ | | |
+ | | |
+ | | |
+ +-----------------+-------+
+
+ New Behaviour :
+ +-----------------+-------+
+ | | |
+ | | N |
+ | | |
+ | P +-------+
+ | | |
+ | | |
+ | | |
+ +-----------------+-------+
+
+ +-----------------+-------+
+ | | |
+ | | P |
+ | | |
+ | +-------+
+ | | |
+ | | N |
+ | | |
+ +-----------------+-------+
+ """
+
+== YOU MUST ==
+(1). Place the patch file in /etc/portage/patches/x11-wm/dwm/ and run 'emerge dwm'
+
+== YOU PROBABLY SHOULD ==
+No further action is required.
+
+== PATCH MODIFICATIONS ==
+No modifications were made to this patch.
+
+== INCOMPATIBILITIES ==
+No known specific incompatibilities.
diff --git a/attachaside/attachaside.patch b/attachaside/attachaside.patch
@@ -0,0 +1,92 @@
+diff --git a/dwm.c b/dwm.c
+index ec6a27c..7b6ce67 100644
+--- a/dwm.c
++++ b/dwm.c
+@@ -49,7 +49,8 @@
+ #define CLEANMASK(mask) (mask & ~(numlockmask|LockMask) & (ShiftMask|ControlMask|Mod1Mask|Mod2Mask|Mod3Mask|Mod4Mask|Mod5Mask))
+ #define INTERSECT(x,y,w,h,m) (MAX(0, MIN((x)+(w),(m)->wx+(m)->ww) - MAX((x),(m)->wx)) \
+ * MAX(0, MIN((y)+(h),(m)->wy+(m)->wh) - MAX((y),(m)->wy)))
+-#define ISVISIBLE(C) ((C->tags & C->mon->tagset[C->mon->seltags]))
++#define ISVISIBLEONTAG(C, T) ((C->tags & T))
++#define ISVISIBLE(C) ISVISIBLEONTAG(C, C->mon->tagset[C->mon->seltags])
+ #define LENGTH(X) (sizeof X / sizeof X[0])
+ #define MOUSEMASK (BUTTONMASK|PointerMotionMask)
+ #define WIDTH(X) ((X)->w + 2 * (X)->bw)
+@@ -148,6 +149,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 attachaside(Client *c);
+ static void attachstack(Client *c);
+ static void buttonpress(XEvent *e);
+ static void checkotherwm(void);
+@@ -184,6 +186,7 @@ static void maprequest(XEvent *e);
+ static void monocle(Monitor *m);
+ static void motionnotify(XEvent *e);
+ static void movemouse(const Arg *arg);
++static Client *nexttagged(Client *c);
+ static Client *nexttiled(Client *c);
+ static void pop(Client *);
+ static void propertynotify(XEvent *e);
+@@ -407,6 +410,18 @@ attach(Client *c)
+ c->mon->clients = c;
+ }
+
++void
++attachaside(Client *c) {
++ Client *at = nexttagged(c);
++ if(!at) {
++ attach(c);
++ return;
++ }
++ c->next = at->next;
++ at->next = c;
++}
++
++
+ void
+ attachstack(Client *c)
+ {
+@@ -1063,7 +1078,7 @@ manage(Window w, XWindowAttributes *wa)
+ c->isfloating = c->oldstate = trans != None || c->isfixed;
+ if (c->isfloating)
+ XRaiseWindow(dpy, c->win);
+- attach(c);
++ attachaside(c);
+ attachstack(c);
+ XChangeProperty(dpy, root, netatom[NetClientList], XA_WINDOW, 32, PropModeAppend,
+ (unsigned char *) &(c->win), 1);
+@@ -1193,6 +1208,16 @@ movemouse(const Arg *arg)
+ }
+ }
+
++ Client *
++nexttagged(Client *c) {
++ Client *walked = c->mon->clients;
++ for(;
++ walked && (walked->isfloating || !ISVISIBLEONTAG(walked, c->tags));
++ walked = walked->next
++ );
++ return walked;
++}
++
+ Client *
+ nexttiled(Client *c)
+ {
+@@ -1418,7 +1443,7 @@ sendmon(Client *c, Monitor *m)
+ detachstack(c);
+ c->mon = m;
+ c->tags = m->tagset[m->seltags]; /* assign tags of target monitor */
+- attach(c);
++ attachaside(c);
+ attachstack(c);
+ focus(NULL);
+ arrange(NULL);
+@@ -1899,6 +1924,7 @@ updategeom(void)
+ detachstack(c);
+ c->mon = mons;
+ attach(c);
++ attachaside(c);
+ attachstack(c);
+ }
+ if (m == selmon)