Return to repo list

suckless-gf-dwm

Gentoo-friendly patches for Suckless's dwm.
Return to HMagellan.com

commit 76c4120662b2f96be1d654308fa6cd3fc4a04dad
parent 672d0020cc076da4eec5f5e106ab97a367f666af
Author: Erik Letson <hmagellan@hmagellan.com>
Date:   Thu, 13 Aug 2020 22:16:31 -0500

Added attachasideandbelow, attachbottom, and attachtop

Diffstat:
MREADME | 2+-
Aattachasideandbelow/USAGE | 25+++++++++++++++++++++++++
Aattachasideandbelow/attachasideandbelow.patch | 100+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
Aattachbottom/USAGE | 22++++++++++++++++++++++
Aattachbottom/attachbottom.patch | 71+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
Aattachtop/USAGE | 25+++++++++++++++++++++++++
Aattachtop/attachtop.patch | 88+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
7 files changed, 332 insertions(+), 1 deletion(-)

diff --git a/README b/README @@ -42,7 +42,7 @@ patches! (1). https://dwm.suckless.org/patches/ - CURRENT PROGRESS: 13/172 patches supported + CURRENT PROGRESS: 16/172 patches supported 1/172 patches unsupported USUPPORTED PATCHES: diff --git a/attachasideandbelow/USAGE b/attachasideandbelow/USAGE @@ -0,0 +1,25 @@ +attachasideandbelow - Combine the behavior of attachaside and attachbelow +Source: https://dwm.suckless.org/patches/attachasideandbelow/dwm-attachasideandbelow-20200702-f04cac6.diff +Original Authors: Cássio Ávila - cassioavila@yandex.com + Jerome Andrieux - jerome@gcu.info (attachaside patch) + Chris Down - chris@chrisdown.name (attachaside patch 6.1 port and fixes) + Laslo Hunhold - dev@frign.de (attachaside patch git port) + Jonathan Hodgson - git@jonathanh.co.uk (attachbelow patch) + +Description from source: + """ + Combination between attachaside and attachbelow. Clients will not be pushed down in the stack, only + resized, and the master can't be pushed to the slave stack by spawning another client. + """ + +== 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/attachasideandbelow/attachasideandbelow.patch b/attachasideandbelow/attachasideandbelow.patch @@ -0,0 +1,100 @@ +diff -up b/dwm.c a/dwm.c +--- b/dwm.c 2020-07-05 16:05:02.555947738 -0300 ++++ a/dwm.c 2020-07-05 16:06:19.592609932 -0300 +@@ -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) +@@ -147,6 +148,7 @@ static int applysizehints(Client *c, int + static void arrange(Monitor *m); + static void arrangemon(Monitor *m); + static void attach(Client *c); ++static void attachBelow(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); +@@ -406,6 +409,27 @@ attach(Client *c) + c->next = c->mon->clients; + c->mon->clients = c; + } ++void ++attachBelow(Client *c) ++{ ++ //If there is nothing on the monitor or the selected client is floating, attach as normal ++ if(c->mon->sel == NULL || c->mon->sel->isfloating) { ++ Client *at = nexttagged(c); ++ if(!at) { ++ attach(c); ++ return; ++ } ++ c->next = at->next; ++ at->next = c; ++ return; ++ } ++ ++ //Set the new client's next property to the same as the currently selected clients next ++ c->next = c->mon->sel->next; ++ //Set the currently selected clients next property to the new client ++ c->mon->sel->next = c; ++ ++} + + void + attachstack(Client *c) +@@ -1063,7 +1087,7 @@ manage(Window w, XWindowAttributes *wa) + c->isfloating = c->oldstate = trans != None || c->isfixed; + if (c->isfloating) + XRaiseWindow(dpy, c->win); +- attach(c); ++ attachBelow(c); + attachstack(c); + XChangeProperty(dpy, root, netatom[NetClientList], XA_WINDOW, 32, PropModeAppend, + (unsigned char *) &(c->win), 1); +@@ -1193,6 +1217,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 +1452,7 @@ sendmon(Client *c, Monitor *m) + detachstack(c); + c->mon = m; + c->tags = m->tagset[m->seltags]; /* assign tags of target monitor */ +- attach(c); ++ attachBelow(c); + attachstack(c); + focus(NULL); + arrange(NULL); +@@ -1901,6 +1935,7 @@ updategeom(void) + detachstack(c); + c->mon = mons; + attach(c); ++ attachBelow(c); + attachstack(c); + } + if (m == selmon) diff --git a/attachbottom/USAGE b/attachbottom/USAGE @@ -0,0 +1,22 @@ +attachbottom - New clients attach at the bottom of the stack instead of the top +Source: https://dwm.suckless.org/patches/attachbottom/dwm-attachbottom-6.2.diff +Original Author: Marshall Mason - <marshallmason2@gmail.com> + +Description from source: + """ + 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 clients are ever moved, only resized. + """ + +== 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/attachbottom/attachbottom.patch b/attachbottom/attachbottom.patch @@ -0,0 +1,71 @@ +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 + 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); +@@ -406,6 +407,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) + { +@@ -1062,7 +1075,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); +@@ -1417,7 +1430,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); +@@ -1897,7 +1910,7 @@ updategeom(void) + m->clients = c->next; + detachstack(c); + c->mon = mons; +- attach(c); ++ attachbottom(c); + attachstack(c); + } + if (m == selmon) +-- +2.17.1 + diff --git a/attachtop/USAGE b/attachtop/USAGE @@ -0,0 +1,25 @@ +attachtop - New client attaches below the last master/on top of the stack +Source: https://dwm.suckless.org/patches/attachtop/dwm-attachtop-6.2.diff +Original Author: MLquest8 (miskuzius at gmail.com) + +Description from source: + """ + New client attaches below the last master/on top of the stack. + + Behavior feels very intuitive as it doesn't disrupt existing masters no matter the amount + of them, it only pushes the clients in stack down. In case of nmaster = 1 feels like attachaside + + Is included in attachdirection + """ + +== 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/attachtop/attachtop.patch b/attachtop/attachtop.patch @@ -0,0 +1,88 @@ +From 17acbdcb56d0d2f39507a3f67ef329c14a213ef6 Mon Sep 17 00:00:00 2001 +From: MLquest8 <miskuzius@gmail.com> +Date: Thu, 18 Jun 2020 15:34:18 +0400 +Subject: [PATCH] attachtop. Attaches new client below the last master/on top + of the stack. In case of nmaster = 1 behaves like attachaside. + +--- + dwm.c | 29 +++++++++++++++++++++++++---- + 1 file changed, 25 insertions(+), 4 deletions(-) + +diff --git a/dwm.c b/dwm.c +index 9fd0286..7ced982 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) +@@ -147,6 +148,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 attachtop(Client *c); + static void attachstack(Client *c); + static void buttonpress(XEvent *e); + static void checkotherwm(void); +@@ -407,6 +409,25 @@ attach(Client *c) + c->mon->clients = c; + } + ++void ++attachtop(Client *c) ++{ ++ int n; ++ Monitor *m = selmon; ++ Client *below; ++ ++ for (n = 1, below = c->mon->clients; ++ below && below->next && (below->isfloating || !ISVISIBLEONTAG(below, c->tags) || n != m->nmaster); ++ n = below->isfloating || !ISVISIBLEONTAG(below, c->tags) ? n + 0 : n + 1, below = below->next); ++ c->next = NULL; ++ if (below) { ++ c->next = below->next; ++ below->next = c; ++ } ++ else ++ c->mon->clients = c; ++} ++ + void + attachstack(Client *c) + { +@@ -1063,7 +1084,7 @@ manage(Window w, XWindowAttributes *wa) + c->isfloating = c->oldstate = trans != None || c->isfixed; + if (c->isfloating) + XRaiseWindow(dpy, c->win); +- attach(c); ++ attachtop(c); + attachstack(c); + XChangeProperty(dpy, root, netatom[NetClientList], XA_WINDOW, 32, PropModeAppend, + (unsigned char *) &(c->win), 1); +@@ -1418,7 +1439,7 @@ sendmon(Client *c, Monitor *m) + detachstack(c); + c->mon = m; + c->tags = m->tagset[m->seltags]; /* assign tags of target monitor */ +- attach(c); ++ attachtop(c); + attachstack(c); + focus(NULL); + arrange(NULL); +@@ -1900,7 +1921,7 @@ updategeom(void) + m->clients = c->next; + detachstack(c); + c->mon = mons; +- attach(c); ++ attachtop(c); + attachstack(c); + } + if (m == selmon) +-- +2.26.2 +