commit 089b88d2e4fcbbff9cf07ef4c9f099ea3e5cbae4
parent 5f6eacc47c53301078a9ede5c9db01cce6ffc9fd
Author: finwo <finwo@pm.me>
Date: Mon, 25 Nov 2019 16:10:31 +0100
Added scratchpad, attachbottom, no-single-border
Diffstat:
3 files changed, 221 insertions(+), 0 deletions(-)
diff --git a/dwm/root/etc/portage/patches/x11-wm/dwm/00-attach-bottom.diff b/dwm/root/etc/portage/patches/x11-wm/dwm/00-attach-bottom.diff
@@ -0,0 +1,60 @@
+Binary files dwm/drw.o and dwm.patched/drw.o differ
+Binary files dwm/dwm and dwm.patched/dwm differ
+diff -ruN dwm/dwm.c dwm.patched/dwm.c
+--- dwm/dwm.c 2018-05-22 20:05:47.208417141 -0700
++++ dwm.patched/dwm.c 2018-06-20 15:08:07.380496725 -0700
+@@ -147,6 +147,7 @@
+ 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);
+@@ -407,6 +408,17 @@
+ }
+
+ void
++attachbelow(Client *c)
++{
++ Client *below = c->mon->clients;
++ for (; below && below->next; below = below->next);
++ if (below)
++ below->next = c;
++ else
++ c->mon->clients = c;
++}
++
++void
+ attachstack(Client *c)
+ {
+ c->snext = c->mon->stack;
+@@ -1065,7 +1077,7 @@
+ 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);
+@@ -1420,7 +1432,7 @@
+ 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);
+@@ -1900,7 +1912,7 @@
+ m->clients = c->next;
+ detachstack(c);
+ c->mon = mons;
+- attach(c);
++ attachbelow(c);
+ attachstack(c);
+ }
+ if (m == selmon)
+Binary files dwm/dwm.o and dwm.patched/dwm.o differ
+Binary files dwm/util.o and dwm.patched/util.o differ
diff --git a/dwm/root/etc/portage/patches/x11-wm/dwm/01-no-single-border.diff b/dwm/root/etc/portage/patches/x11-wm/dwm/01-no-single-border.diff
@@ -0,0 +1,71 @@
+diff --git a/dwm.c b/dwm.c
+index 0362114..e3209e5 100644
+--- a/dwm.c
++++ b/dwm.c
+@@ -393,9 +393,24 @@ arrange(Monitor *m)
+ void
+ arrangemon(Monitor *m)
+ {
++ int n = 0;
++ Client *c;
+ strncpy(m->ltsymbol, m->lt[m->sellt]->symbol, sizeof m->ltsymbol);
+- if (m->lt[m->sellt]->arrange)
+- m->lt[m->sellt]->arrange(m);
++ for (n = 0, c = nexttiled(m->clients); c; c = nexttiled(c->next), n++);
++ if ((m->lt[m->sellt]->arrange != monocle && n > 1) || !m->lt[m->sellt]->arrange) {
++ for (c = m->clients; c; c = c->next) {
++ if (ISVISIBLE(c) && (!m->lt[m->sellt]->arrange || !c->isfloating) && (c->bw != borderpx)) {
++ c->oldbw = c->bw;
++ c->bw = borderpx;
++ resizeclient(c, m->wx, m->wy, m->ww - (2 * c->bw), m->wh - (2 * c->bw));
++ }
++ }
++ if (m->lt[m->sellt]->arrange) {
++ m->lt[m->sellt]->arrange(m);
++ }
++ } else {
++ monocle(m);
++ }
+ }
+
+ void
+@@ -1123,10 +1138,19 @@ monocle(Monitor *m)
+ for (c = m->clients; c; c = c->next)
+ if (ISVISIBLE(c))
+ n++;
+- if (n > 0) /* override layout symbol */
++ if (n > 0 && m->lt[m->sellt]->arrange == monocle) /* override layout symbol */
+ snprintf(m->ltsymbol, sizeof m->ltsymbol, "[%d]", n);
+- for (c = nexttiled(m->clients); c; c = nexttiled(c->next))
+- resize(c, m->wx, m->wy, m->ww - 2 * c->bw, m->wh - 2 * c->bw, 0);
++ for(c = nexttiled(m->clients); c; c = nexttiled(c->next)) {
++ // I'm not sure, but calling resize with the border width subtractions
++ // fixes a glitch where windows would not redraw until they were
++ // manually resized after restarting dwm.
++ resize(c, m->wx, m->wy, m->ww - (2 * c->bw), m->wh - (2 * c->bw), False);
++ if (c->bw) {
++ c->oldbw = c->bw;
++ c->bw = 0;
++ resizeclient(c, m->wx, m->wy, m->ww, m->wh);
++ }
++ }
+ }
+
+ void
+@@ -1706,9 +1730,14 @@ togglefloating(const Arg *arg)
+ if (selmon->sel->isfullscreen) /* no support for fullscreen windows */
+ return;
+ selmon->sel->isfloating = !selmon->sel->isfloating || selmon->sel->isfixed;
+- if (selmon->sel->isfloating)
++ if (selmon->sel->isfloating) {
++ if (selmon->sel->bw != borderpx) {
++ selmon->sel->oldbw = selmon->sel->bw;
++ selmon->sel->bw = borderpx;
++ }
+ resize(selmon->sel, selmon->sel->x, selmon->sel->y,
+- selmon->sel->w, selmon->sel->h, 0);
++ selmon->sel->w - selmon->sel->bw * 2, selmon->sel->h - selmon->sel->bw * 2, 0);
++ }
+ arrange(selmon);
+ }
+
diff --git a/dwm/root/etc/portage/patches/x11-wm/dwm/10-scratchpad.diff b/dwm/root/etc/portage/patches/x11-wm/dwm/10-scratchpad.diff
@@ -0,0 +1,90 @@
+diff -up a/config.def.h b/config.def.h
+--- a/config.def.h 2019-06-06 21:23:27.006661784 +0200
++++ b/config.def.h 2019-06-20 15:05:59.083102462 +0200
+@@ -58,11 +58,14 @@ static const Layout layouts[] = {
+ static char dmenumon[2] = "0"; /* component of dmenucmd, manipulated in spawn() */
+ static const char *dmenucmd[] = { "dmenu_run", "-m", dmenumon, "-fn", dmenufont, "-nb", col_gray1, "-nf", col_gray3, "-sb", col_cyan, "-sf", col_gray4, NULL };
+ static const char *termcmd[] = { "st", NULL };
++static const char scratchpadname[] = "scratchpad";
++static const char *scratchpadcmd[] = { "st", "-t", scratchpadname, "-g", "120x34", NULL };
+
+ static Key keys[] = {
+ /* modifier key function argument */
+ { MODKEY, XK_p, spawn, {.v = dmenucmd } },
+ { MODKEY|ShiftMask, XK_Return, spawn, {.v = termcmd } },
++ { MODKEY, XK_grave, togglescratch, {.v = scratchpadcmd } },
+ { MODKEY, XK_b, togglebar, {0} },
+ { MODKEY, XK_j, focusstack, {.i = +1 } },
+ { MODKEY, XK_k, focusstack, {.i = -1 } },
+diff -up a/dwm.c b/dwm.c
+--- a/dwm.c 2019-06-06 21:23:27.023328450 +0200
++++ b/dwm.c 2019-06-20 15:07:01.089767947 +0200
+@@ -213,6 +213,7 @@ static void tagmon(const Arg *arg);
+ static void tile(Monitor *);
+ static void togglebar(const Arg *arg);
+ static void togglefloating(const Arg *arg);
++static void togglescratch(const Arg *arg);
+ static void toggletag(const Arg *arg);
+ static void toggleview(const Arg *arg);
+ static void unfocus(Client *c, int setfocus);
+@@ -273,6 +274,8 @@ static Window root, wmcheckwin;
+ /* configuration, allows nested code to access above variables */
+ #include "config.h"
+
++static unsigned int scratchtag = 1 << LENGTH(tags);
++
+ /* compile-time check if all tags fit into an unsigned int bit array. */
+ struct NumTags { char limitexceeded[LENGTH(tags) > 31 ? -1 : 1]; };
+
+@@ -1052,6 +1055,14 @@ manage(Window w, XWindowAttributes *wa)
+ && (c->x + (c->w / 2) < c->mon->wx + c->mon->ww)) ? bh : c->mon->my);
+ c->bw = borderpx;
+
++ selmon->tagset[selmon->seltags] &= ~scratchtag;
++ if (!strcmp(c->name, scratchpadname)) {
++ c->mon->tagset[c->mon->seltags] |= c->tags = scratchtag;
++ c->isfloating = True;
++ c->x = c->mon->wx + (c->mon->ww / 2 - WIDTH(c) / 2);
++ c->y = c->mon->wy + (c->mon->wh / 2 - HEIGHT(c) / 2);
++ }
++
+ wc.border_width = c->bw;
+ XConfigureWindow(dpy, w, CWBorderWidth, &wc);
+ XSetWindowBorder(dpy, w, scheme[SchemeNorm][ColBorder].pixel);
+@@ -1661,6 +1672,7 @@ spawn(const Arg *arg)
+ {
+ if (arg->v == dmenucmd)
+ dmenumon[0] = '0' + selmon->num;
++ selmon->tagset[selmon->seltags] &= ~scratchtag;
+ if (fork() == 0) {
+ if (dpy)
+ close(ConnectionNumber(dpy));
+@@ -1748,6 +1760,28 @@ togglefloating(const Arg *arg)
+ }
+
+ void
++togglescratch(const Arg *arg)
++{
++ Client *c;
++ unsigned int found = 0;
++
++ for (c = selmon->clients; c && !(found = c->tags & scratchtag); c = c->next);
++ if (found) {
++ unsigned int newtagset = selmon->tagset[selmon->seltags] ^ scratchtag;
++ if (newtagset) {
++ selmon->tagset[selmon->seltags] = newtagset;
++ focus(NULL);
++ arrange(selmon);
++ }
++ if (ISVISIBLE(c)) {
++ focus(c);
++ restack(selmon);
++ }
++ } else
++ spawn(arg);
++}
++
++void
+ toggletag(const Arg *arg)
+ {
+ unsigned int newtags;