summaryrefslogtreecommitdiff
path: root/dwm
diff options
context:
space:
mode:
Diffstat (limited to 'dwm')
-rw-r--r--dwm/config.h83
-rw-r--r--dwm/patches/dwm-fullscreen-6.2.diff56
-rw-r--r--dwm/patches/dwm-hide_vacant_tags-6.2.diff55
-rw-r--r--dwm/patches/dwm-scratchpad-6.2.diff90
-rw-r--r--dwm/patches/dwm-statuscolors-20181008-b69c870.diff94
-rw-r--r--dwm/patches/dwm-vanitygaps-20190508-6.2.diff259
6 files changed, 621 insertions, 16 deletions
diff --git a/dwm/config.h b/dwm/config.h
index ccaface..495e8fe 100644
--- a/dwm/config.h
+++ b/dwm/config.h
@@ -1,25 +1,36 @@
1/* See LICENSE file for copyright and license details. */ 1/* See LICENSE file for copyright and license details. */
2 2#include <X11/XF86keysym.h>
3/* appearance */ 3/* appearance */
4static const unsigned int borderpx = 1; /* border pixel of windows */ 4static const unsigned int borderpx = 0; /* border pixel of windows */
5static const unsigned int snap = 32; /* snap pixel */ 5static const unsigned int snap = 32; /* snap pixel */
6static const unsigned int gappih = 8; /* horiz inner gap between windows */
7static const unsigned int gappiv = 8; /* vert inner gap between windows */
8static const unsigned int gappoh = 8; /* horiz outer gap between windows and screen edge */
9static const unsigned int gappov = 8; /* vert outer gap between windows and screen edge */
10static const int smartgaps = 0; /* 1 means no outer gap when there is only one window */
6static const int showbar = 1; /* 0 means no bar */ 11static const int showbar = 1; /* 0 means no bar */
7static const int topbar = 1; /* 0 means bottom bar */ 12static const int topbar = 1; /* 0 means bottom bar */
8static const char *fonts[] = { "Hermit:pixelsize=12:antialias:true:autohint=true" }; 13static const char *fonts[] = { "Hermit:pixelsize=11:antialias=true:autohint=true" };
9static const char dmenufont[] = "Hermit:pixelsize=12:antialias:true:autohint=true"; 14static const char col_gray1[] = "#000000";
10static const char col_gray1[] = "#222222";
11static const char col_gray2[] = "#444444"; 15static const char col_gray2[] = "#444444";
12static const char col_gray3[] = "#bbbbbb"; 16static const char col_gray3[] = "#bbbbbb";
13static const char col_gray4[] = "#eeeeee"; 17static const char col_gray4[] = "#000000";
14static const char col_cyan[] = "#005577"; 18static const char col_cyan[] = "#84a0c6";
19static const char col_black[] = "#000000";
20static const char col_red[] = "#ff0000";
21static const char col_yellow[] = "#ffff00";
22static const char col_white[] = "#ffffff";
23
15static const char *colors[][3] = { 24static const char *colors[][3] = {
16 /* fg bg border */ 25 /* fg bg border */
17 [SchemeNorm] = { col_gray3, col_gray1, col_gray2 }, 26 [SchemeNorm] = { col_gray3, col_gray1, col_gray2 },
18 [SchemeSel] = { col_gray4, col_cyan, col_cyan }, 27 [SchemeSel] = { col_gray4, col_cyan, col_cyan },
28 [SchemeWarn] = { col_black, col_yellow, col_red },
29 [SchemeUrgent]= { col_white, col_red, col_red },
19}; 30};
20 31
21/* tagging */ 32/* tagging */
22static const char *tags[] = { "1", "2", "3", "4", "5", "6", "7", "8", "9" }; 33static const char *tags[] = { "term", "web", "music", "file", "virt", "hack", "7", "8", "9" };
23 34
24static const Rule rules[] = { 35static const Rule rules[] = {
25 /* xprop(1): 36 /* xprop(1):
@@ -28,11 +39,11 @@ static const Rule rules[] = {
28 */ 39 */
29 /* class instance title tags mask isfloating monitor */ 40 /* class instance title tags mask isfloating monitor */
30 { "Gimp", NULL, NULL, 0, 1, -1 }, 41 { "Gimp", NULL, NULL, 0, 1, -1 },
31 { "Firefox", NULL, NULL, 1 << 8, 0, -1 }, 42 { "Firefox", NULL, NULL, 2, 0, -1 },
32}; 43};
33 44
34/* layout(s) */ 45/* layout(s) */
35static const float mfact = 0.55; /* factor of master area size [0.05..0.95] */ 46static const float mfact = 0.50; /* factor of master area size [0.05..0.95] */
36static const int nmaster = 1; /* number of clients in master area */ 47static const int nmaster = 1; /* number of clients in master area */
37static const int resizehints = 1; /* 1 means respect size hints in tiled resizals */ 48static const int resizehints = 1; /* 1 means respect size hints in tiled resizals */
38 49
@@ -56,13 +67,36 @@ static const Layout layouts[] = {
56 67
57/* commands */ 68/* commands */
58static char dmenumon[2] = "0"; /* component of dmenucmd, manipulated in spawn() */ 69static char dmenumon[2] = "0"; /* component of dmenucmd, manipulated in spawn() */
59static const char *dmenucmd[] = { "dmenu_run", "-m", dmenumon, "-fn", dmenufont, "-nb", col_gray1, "-nf", col_gray3, "-sb", col_cyan, "-sf", col_gray4, NULL }; 70static const char *dmenucmd[] = { "menu", NULL };
60static const char *termcmd[] = { "st", NULL }; 71static const char *termcmd[] = { "st", NULL };
72static const char scratchpadname[] = "scratchpad";
73static const char *scratchpadcmd[] = { "st", "-t", scratchpadname, "-g", "120x34", NULL };
74
75/* volume */
76static const char *upvol[] = { "pulsemixer", "--change-volume", "+5", NULL };
77static const char *downvol[] = { "pulsemixer", "--change-volume", "-5", NULL };
78static const char *mutevol[] = { "pulsemixer", "--toggle-mute", NULL };
79static const char *shut[] = { "shut", NULL };
80
81/* brightness */
82static const char *brightup[] = { "doas", "bup", NULL };
83static const char *brightdown[] = { "doas", "bdown", NULL };
84
85/* lock */
86static const char *lock[] = { "xset", "s", "activate", NULL };
61 87
62static Key keys[] = { 88static Key keys[] = {
63 /* modifier key function argument */ 89 /* modifier key function argument */
64 { MODKEY, XK_p, spawn, {.v = dmenucmd } }, 90 { MODKEY, XK_p, spawn, {.v = dmenucmd } },
65 { MODKEY, XK_Return, spawn, {.v = termcmd } }, 91 { MODKEY, XK_Return, spawn, {.v = termcmd } },
92 { MODKEY, XK_grave, togglescratch, {.v = scratchpadcmd } },
93 { MODKEY, XK_x, spawn, {.v = shut } },
94 { 0, XF86XK_AudioLowerVolume, spawn, {.v = downvol } },
95 { 0, XF86XK_AudioMute, spawn, {.v = mutevol } },
96 { 0, XF86XK_AudioRaiseVolume, spawn, {.v = upvol } },
97 { 0, XF86XK_MonBrightnessUp, spawn, {.v = brightup } },
98 { 0, XF86XK_MonBrightnessDown, spawn, {.v = brightdown } },
99 { MODKEY|ShiftMask, XK_Delete, spawn, {.v = lock } },
66 { MODKEY, XK_b, togglebar, {0} }, 100 { MODKEY, XK_b, togglebar, {0} },
67 { MODKEY, XK_j, focusstack, {.i = +1 } }, 101 { MODKEY, XK_j, focusstack, {.i = +1 } },
68 { MODKEY, XK_k, focusstack, {.i = -1 } }, 102 { MODKEY, XK_k, focusstack, {.i = -1 } },
@@ -70,12 +104,29 @@ static Key keys[] = {
70 { MODKEY, XK_d, incnmaster, {.i = -1 } }, 104 { MODKEY, XK_d, incnmaster, {.i = -1 } },
71 { MODKEY, XK_h, setmfact, {.f = -0.05} }, 105 { MODKEY, XK_h, setmfact, {.f = -0.05} },
72 { MODKEY, XK_l, setmfact, {.f = +0.05} }, 106 { MODKEY, XK_l, setmfact, {.f = +0.05} },
107 { MODKEY|Mod4Mask, XK_h, incrgaps, {.i = +1 } },
108 { MODKEY|Mod4Mask, XK_l, incrgaps, {.i = -1 } },
109 { MODKEY|Mod4Mask|ShiftMask, XK_h, incrogaps, {.i = +1 } },
110 { MODKEY|Mod4Mask|ShiftMask, XK_l, incrogaps, {.i = -1 } },
111 { MODKEY|Mod4Mask|ControlMask, XK_h, incrigaps, {.i = +1 } },
112 { MODKEY|Mod4Mask|ControlMask, XK_l, incrigaps, {.i = -1 } },
113 { MODKEY|Mod4Mask, XK_0, togglegaps, {0} },
114 { MODKEY|Mod4Mask|ShiftMask, XK_0, defaultgaps, {0} },
115 { MODKEY, XK_y, incrihgaps, {.i = +1 } },
116 { MODKEY, XK_o, incrihgaps, {.i = -1 } },
117 { MODKEY|ControlMask, XK_y, incrivgaps, {.i = +1 } },
118 { MODKEY|ControlMask, XK_o, incrivgaps, {.i = -1 } },
119 { MODKEY|Mod4Mask, XK_y, incrohgaps, {.i = +1 } },
120 { MODKEY|Mod4Mask, XK_o, incrohgaps, {.i = -1 } },
121 { MODKEY|ShiftMask, XK_y, incrovgaps, {.i = +1 } },
122 { MODKEY|ShiftMask, XK_o, incrovgaps, {.i = -1 } },
73 { MODKEY, XK_Return, zoom, {0} }, 123 { MODKEY, XK_Return, zoom, {0} },
74 { MODKEY, XK_Tab, view, {0} }, 124 { MODKEY, XK_Tab, view, {0} },
75 { MODKEY, XK_w, killclient, {0} }, 125 { MODKEY, XK_w, killclient, {0} },
76 { MODKEY, XK_t, setlayout, {.v = &layouts[0]} }, 126 { MODKEY, XK_t, setlayout, {.v = &layouts[0]} },
77 { MODKEY, XK_f, setlayout, {.v = &layouts[1]} }, 127 { MODKEY, XK_f, setlayout, {.v = &layouts[1]} },
78 { MODKEY, XK_m, setlayout, {.v = &layouts[2]} }, 128 { MODKEY, XK_m, setlayout, {.v = &layouts[2]} },
129 { MODKEY|ShiftMask, XK_f, fullscreen, {0} },
79 { MODKEY, XK_space, setlayout, {0} }, 130 { MODKEY, XK_space, setlayout, {0} },
80 { MODKEY|ShiftMask, XK_space, togglefloating, {0} }, 131 { MODKEY|ShiftMask, XK_space, togglefloating, {0} },
81 { MODKEY, XK_0, view, {.ui = ~0 } }, 132 { MODKEY, XK_0, view, {.ui = ~0 } },
diff --git a/dwm/patches/dwm-fullscreen-6.2.diff b/dwm/patches/dwm-fullscreen-6.2.diff
new file mode 100644
index 0000000..36e3140
--- /dev/null
+++ b/dwm/patches/dwm-fullscreen-6.2.diff
@@ -0,0 +1,56 @@
1From 54719285bd1a984e2efce6e8a8eab184fec11abf Mon Sep 17 00:00:00 2001
2From: Sermak <sermak@jarvis.com>
3Date: Mon, 8 Jul 2019 01:06:44 +0200
4Subject: [PATCH] Simulate toggleable fullscreen mode
5
6---
7 config.def.h | 1 +
8 dwm.c | 14 ++++++++++++++
9 2 files changed, 15 insertions(+)
10
11diff --git a/config.def.h b/config.def.h
12index 1c0b587..f774cc5 100644
13--- a/config.def.h
14+++ b/config.def.h
15@@ -76,6 +76,7 @@ static Key keys[] = {
16 { MODKEY, XK_t, setlayout, {.v = &layouts[0]} },
17 { MODKEY, XK_f, setlayout, {.v = &layouts[1]} },
18 { MODKEY, XK_m, setlayout, {.v = &layouts[2]} },
19+ { MODKEY|ShiftMask, XK_f, fullscreen, {0} },
20 { MODKEY, XK_space, setlayout, {0} },
21 { MODKEY|ShiftMask, XK_space, togglefloating, {0} },
22 { MODKEY, XK_0, view, {.ui = ~0 } },
23diff --git a/dwm.c b/dwm.c
24index 4465af1..04b1e06 100644
25--- a/dwm.c
26+++ b/dwm.c
27@@ -199,6 +199,7 @@ static void sendmon(Client *c, Monitor *m);
28 static void setclientstate(Client *c, long state);
29 static void setfocus(Client *c);
30 static void setfullscreen(Client *c, int fullscreen);
31+static void fullscreen(const Arg *arg);
32 static void setlayout(const Arg *arg);
33 static void setmfact(const Arg *arg);
34 static void setup(void);
35@@ -1497,6 +1498,19 @@ setfullscreen(Client *c, int fullscreen)
36 }
37 }
38
39+Layout *last_layout;
40+void
41+fullscreen(const Arg *arg)
42+{
43+ if (selmon->showbar) {
44+ for(last_layout = (Layout *)layouts; last_layout != selmon->lt[selmon->sellt]; last_layout++);
45+ setlayout(&((Arg) { .v = &layouts[2] }));
46+ } else {
47+ setlayout(&((Arg) { .v = last_layout }));
48+ }
49+ togglebar(arg);
50+}
51+
52 void
53 setlayout(const Arg *arg)
54 {
55--
562.22.0
diff --git a/dwm/patches/dwm-hide_vacant_tags-6.2.diff b/dwm/patches/dwm-hide_vacant_tags-6.2.diff
new file mode 100644
index 0000000..a981b23
--- /dev/null
+++ b/dwm/patches/dwm-hide_vacant_tags-6.2.diff
@@ -0,0 +1,55 @@
1diff --git a/dwm.c b/dwm.c
2index 4465af1..c4aa3de 100644
3--- a/dwm.c
4+++ b/dwm.c
5@@ -416,7 +416,7 @@ attachstack(Client *c)
6 void
7 buttonpress(XEvent *e)
8 {
9- unsigned int i, x, click;
10+ unsigned int i, x, click, occ = 0;
11 Arg arg = {0};
12 Client *c;
13 Monitor *m;
14@@ -431,9 +431,14 @@ buttonpress(XEvent *e)
15 }
16 if (ev->window == selmon->barwin) {
17 i = x = 0;
18- do
19+ for (c = m->clients; c; c = c->next)
20+ occ |= c->tags == 255 ? 0 : c->tags;
21+ do {
22+ /* do not reserve space for vacant tags */
23+ if (!(occ & 1 << i || m->tagset[m->seltags] & 1 << i))
24+ continue;
25 x += TEXTW(tags[i]);
26- while (ev->x >= x && ++i < LENGTH(tags));
27+ } while (ev->x >= x && ++i < LENGTH(tags));
28 if (i < LENGTH(tags)) {
29 click = ClkTagBar;
30 arg.ui = 1 << i;
31@@ -709,19 +714,19 @@ drawbar(Monitor *m)
32 }
33
34 for (c = m->clients; c; c = c->next) {
35- occ |= c->tags;
36+ occ |= c->tags == 255 ? 0 : c->tags;
37 if (c->isurgent)
38 urg |= c->tags;
39 }
40 x = 0;
41 for (i = 0; i < LENGTH(tags); i++) {
42+ /* do not draw vacant tags */
43+ if (!(occ & 1 << i || m->tagset[m->seltags] & 1 << i))
44+ continue;
45+
46 w = TEXTW(tags[i]);
47 drw_setscheme(drw, scheme[m->tagset[m->seltags] & 1 << i ? SchemeSel : SchemeNorm]);
48 drw_text(drw, x, 0, w, bh, lrpad / 2, tags[i], urg & 1 << i);
49- if (occ & 1 << i)
50- drw_rect(drw, x + boxs, boxs, boxw, boxw,
51- m == selmon && selmon->sel && selmon->sel->tags & 1 << i,
52- urg & 1 << i);
53 x += w;
54 }
55 w = blw = TEXTW(m->ltsymbol);
diff --git a/dwm/patches/dwm-scratchpad-6.2.diff b/dwm/patches/dwm-scratchpad-6.2.diff
new file mode 100644
index 0000000..2062263
--- /dev/null
+++ b/dwm/patches/dwm-scratchpad-6.2.diff
@@ -0,0 +1,90 @@
1diff -up a/config.def.h b/config.def.h
2--- a/config.def.h 2019-06-06 21:23:27.006661784 +0200
3+++ b/config.def.h 2019-06-20 15:05:59.083102462 +0200
4@@ -58,11 +58,14 @@ static const Layout layouts[] = {
5 static char dmenumon[2] = "0"; /* component of dmenucmd, manipulated in spawn() */
6 static const char *dmenucmd[] = { "dmenu_run", "-m", dmenumon, "-fn", dmenufont, "-nb", col_gray1, "-nf", col_gray3, "-sb", col_cyan, "-sf", col_gray4, NULL };
7 static const char *termcmd[] = { "st", NULL };
8+static const char scratchpadname[] = "scratchpad";
9+static const char *scratchpadcmd[] = { "st", "-t", scratchpadname, "-g", "120x34", NULL };
10
11 static Key keys[] = {
12 /* modifier key function argument */
13 { MODKEY, XK_p, spawn, {.v = dmenucmd } },
14 { MODKEY|ShiftMask, XK_Return, spawn, {.v = termcmd } },
15+ { MODKEY, XK_grave, togglescratch, {.v = scratchpadcmd } },
16 { MODKEY, XK_b, togglebar, {0} },
17 { MODKEY, XK_j, focusstack, {.i = +1 } },
18 { MODKEY, XK_k, focusstack, {.i = -1 } },
19diff -up a/dwm.c b/dwm.c
20--- a/dwm.c 2019-06-06 21:23:27.023328450 +0200
21+++ b/dwm.c 2019-06-20 15:07:01.089767947 +0200
22@@ -213,6 +213,7 @@ static void tagmon(const Arg *arg);
23 static void tile(Monitor *);
24 static void togglebar(const Arg *arg);
25 static void togglefloating(const Arg *arg);
26+static void togglescratch(const Arg *arg);
27 static void toggletag(const Arg *arg);
28 static void toggleview(const Arg *arg);
29 static void unfocus(Client *c, int setfocus);
30@@ -273,6 +274,8 @@ static Window root, wmcheckwin;
31 /* configuration, allows nested code to access above variables */
32 #include "config.h"
33
34+static unsigned int scratchtag = 1 << LENGTH(tags);
35+
36 /* compile-time check if all tags fit into an unsigned int bit array. */
37 struct NumTags { char limitexceeded[LENGTH(tags) > 31 ? -1 : 1]; };
38
39@@ -1052,6 +1055,14 @@ manage(Window w, XWindowAttributes *wa)
40 && (c->x + (c->w / 2) < c->mon->wx + c->mon->ww)) ? bh : c->mon->my);
41 c->bw = borderpx;
42
43+ selmon->tagset[selmon->seltags] &= ~scratchtag;
44+ if (!strcmp(c->name, scratchpadname)) {
45+ c->mon->tagset[c->mon->seltags] |= c->tags = scratchtag;
46+ c->isfloating = True;
47+ c->x = c->mon->wx + (c->mon->ww / 2 - WIDTH(c) / 2);
48+ c->y = c->mon->wy + (c->mon->wh / 2 - HEIGHT(c) / 2);
49+ }
50+
51 wc.border_width = c->bw;
52 XConfigureWindow(dpy, w, CWBorderWidth, &wc);
53 XSetWindowBorder(dpy, w, scheme[SchemeNorm][ColBorder].pixel);
54@@ -1661,6 +1672,7 @@ spawn(const Arg *arg)
55 {
56 if (arg->v == dmenucmd)
57 dmenumon[0] = '0' + selmon->num;
58+ selmon->tagset[selmon->seltags] &= ~scratchtag;
59 if (fork() == 0) {
60 if (dpy)
61 close(ConnectionNumber(dpy));
62@@ -1748,6 +1760,28 @@ togglefloating(const Arg *arg)
63 }
64
65 void
66+togglescratch(const Arg *arg)
67+{
68+ Client *c;
69+ unsigned int found = 0;
70+
71+ for (c = selmon->clients; c && !(found = c->tags & scratchtag); c = c->next);
72+ if (found) {
73+ unsigned int newtagset = selmon->tagset[selmon->seltags] ^ scratchtag;
74+ if (newtagset) {
75+ selmon->tagset[selmon->seltags] = newtagset;
76+ focus(NULL);
77+ arrange(selmon);
78+ }
79+ if (ISVISIBLE(c)) {
80+ focus(c);
81+ restack(selmon);
82+ }
83+ } else
84+ spawn(arg);
85+}
86+
87+void
88 toggletag(const Arg *arg)
89 {
90 unsigned int newtags;
diff --git a/dwm/patches/dwm-statuscolors-20181008-b69c870.diff b/dwm/patches/dwm-statuscolors-20181008-b69c870.diff
new file mode 100644
index 0000000..8c7869a
--- /dev/null
+++ b/dwm/patches/dwm-statuscolors-20181008-b69c870.diff
@@ -0,0 +1,94 @@
1From 35418d156fccb922710f6ca80a1f3972ba88b42f Mon Sep 17 00:00:00 2001
2From: Danny O'Brien <danny@spesh.com>
3Date: Mon, 8 Oct 2018 19:21:29 -0700
4Subject: [PATCH] Add colors to status message in bar.
5
6This patch matches the format used by
7https://dwm.suckless.org/patches/statuscolors/ -- An \x01 character
8switches to the normal foreground/color combo, \x02 switches to the
9color combo used for selected tags, \03 is set by default to black on
10yellow, \04 is white on red.
11
12These color settings are defined in the colors array in config.def.h.
13More can be added, but don't have more than 32, or you'll start hitting
14real ASCII.
15
16This applies cleanly on mainline dwm from commit 022d076 (Sat Jan 7
1717:21:29 2017 +0100) until at least b69c870 (Sat Jun 2 17:15:42 2018
18+020).
19
20---
21 config.def.h | 13 ++++++++++---
22 dwm.c | 18 ++++++++++++++++--
23 2 files changed, 26 insertions(+), 5 deletions(-)
24
25diff --git a/config.def.h b/config.def.h
26index 1c0b587..df92695 100644
27--- a/config.def.h
28+++ b/config.def.h
29@@ -12,10 +12,17 @@ static const char col_gray2[] = "#444444";
30 static const char col_gray3[] = "#bbbbbb";
31 static const char col_gray4[] = "#eeeeee";
32 static const char col_cyan[] = "#005577";
33+static const char col_black[] = "#000000";
34+static const char col_red[] = "#ff0000";
35+static const char col_yellow[] = "#ffff00";
36+static const char col_white[] = "#ffffff";
37+
38 static const char *colors[][3] = {
39- /* fg bg border */
40- [SchemeNorm] = { col_gray3, col_gray1, col_gray2 },
41- [SchemeSel] = { col_gray4, col_cyan, col_cyan },
42+ /* fg bg border */
43+ [SchemeNorm] = { col_gray3, col_gray1, col_gray2 },
44+ [SchemeSel] = { col_gray4, col_cyan, col_cyan },
45+ [SchemeWarn] = { col_black, col_yellow, col_red },
46+ [SchemeUrgent]= { col_white, col_red, col_red },
47 };
48
49 /* tagging */
50diff --git a/dwm.c b/dwm.c
51index 4465af1..9d9d46f 100644
52--- a/dwm.c
53+++ b/dwm.c
54@@ -59,7 +59,7 @@
55
56 /* enums */
57 enum { CurNormal, CurResize, CurMove, CurLast }; /* cursor */
58-enum { SchemeNorm, SchemeSel }; /* color schemes */
59+enum { SchemeNorm, SchemeSel, SchemeWarn, SchemeUrgent }; /* color schemes */
60 enum { NetSupported, NetWMName, NetWMState, NetWMCheck,
61 NetWMFullscreen, NetActiveWindow, NetWMWindowType,
62 NetWMWindowTypeDialog, NetClientList, NetLast }; /* EWMH atoms */
63@@ -699,13 +699,27 @@ drawbar(Monitor *m)
64 int boxs = drw->fonts->h / 9;
65 int boxw = drw->fonts->h / 6 + 2;
66 unsigned int i, occ = 0, urg = 0;
67+ char *ts = stext;
68+ char *tp = stext;
69+ int tx = 0;
70+ char ctmp;
71 Client *c;
72
73 /* draw status first so it can be overdrawn by tags later */
74 if (m == selmon) { /* status is only drawn on selected monitor */
75 drw_setscheme(drw, scheme[SchemeNorm]);
76 sw = TEXTW(stext) - lrpad + 2; /* 2px right padding */
77- drw_text(drw, m->ww - sw, 0, sw, bh, 0, stext, 0);
78+ while (1) {
79+ if ((unsigned int)*ts > LENGTH(colors)) { ts++; continue ; }
80+ ctmp = *ts;
81+ *ts = '\0';
82+ drw_text(drw, m->ww - sw + tx, 0, sw - tx, bh, 0, tp, 0);
83+ tx += TEXTW(tp) -lrpad;
84+ if (ctmp == '\0') { break; }
85+ drw_setscheme(drw, scheme[(unsigned int)(ctmp-1)]);
86+ *ts = ctmp;
87+ tp = ++ts;
88+ }
89 }
90
91 for (c = m->clients; c; c = c->next) {
92--
932.19.1
94
diff --git a/dwm/patches/dwm-vanitygaps-20190508-6.2.diff b/dwm/patches/dwm-vanitygaps-20190508-6.2.diff
new file mode 100644
index 0000000..ea22e23
--- /dev/null
+++ b/dwm/patches/dwm-vanitygaps-20190508-6.2.diff
@@ -0,0 +1,259 @@
1From 20967685d6879bd611a856ade154df19da9ddc7b Mon Sep 17 00:00:00 2001
2From: Stein Gunnar Bakkeby <bakkeby@gmail.com>
3Date: Wed, 8 May 2019 08:07:14 +0200
4Subject: [PATCH] Vanity gaps - allows control of both inner and outer gaps
5 between windows and screen edge
6
7---
8 config.def.h | 21 +++++++++
9 dwm.c | 150 +++++++++++++++++++++++++++++++++++++++++++++++++++++++----
10 2 files changed, 161 insertions(+), 10 deletions(-)
11
12diff --git a/config.def.h b/config.def.h
13index 1c0b587..0927c2d 100644
14--- a/config.def.h
15+++ b/config.def.h
16@@ -3,6 +3,11 @@
17 /* appearance */
18 static const unsigned int borderpx = 1; /* border pixel of windows */
19 static const unsigned int snap = 32; /* snap pixel */
20+static const unsigned int gappih = 10; /* horiz inner gap between windows */
21+static const unsigned int gappiv = 10; /* vert inner gap between windows */
22+static const unsigned int gappoh = 10; /* horiz outer gap between windows and screen edge */
23+static const unsigned int gappov = 10; /* vert outer gap between windows and screen edge */
24+static const int smartgaps = 0; /* 1 means no outer gap when there is only one window */
25 static const int showbar = 1; /* 0 means no bar */
26 static const int topbar = 1; /* 0 means bottom bar */
27 static const char *fonts[] = { "monospace:size=10" };
28@@ -70,6 +75,22 @@ static Key keys[] = {
29 { MODKEY, XK_d, incnmaster, {.i = -1 } },
30 { MODKEY, XK_h, setmfact, {.f = -0.05} },
31 { MODKEY, XK_l, setmfact, {.f = +0.05} },
32+ { MODKEY|Mod4Mask, XK_h, incrgaps, {.i = +1 } },
33+ { MODKEY|Mod4Mask, XK_l, incrgaps, {.i = -1 } },
34+ { MODKEY|Mod4Mask|ShiftMask, XK_h, incrogaps, {.i = +1 } },
35+ { MODKEY|Mod4Mask|ShiftMask, XK_l, incrogaps, {.i = -1 } },
36+ { MODKEY|Mod4Mask|ControlMask, XK_h, incrigaps, {.i = +1 } },
37+ { MODKEY|Mod4Mask|ControlMask, XK_l, incrigaps, {.i = -1 } },
38+ { MODKEY|Mod4Mask, XK_0, togglegaps, {0} },
39+ { MODKEY|Mod4Mask|ShiftMask, XK_0, defaultgaps, {0} },
40+ { MODKEY, XK_y, incrihgaps, {.i = +1 } },
41+ { MODKEY, XK_o, incrihgaps, {.i = -1 } },
42+ { MODKEY|ControlMask, XK_y, incrivgaps, {.i = +1 } },
43+ { MODKEY|ControlMask, XK_o, incrivgaps, {.i = -1 } },
44+ { MODKEY|Mod4Mask, XK_y, incrohgaps, {.i = +1 } },
45+ { MODKEY|Mod4Mask, XK_o, incrohgaps, {.i = -1 } },
46+ { MODKEY|ShiftMask, XK_y, incrovgaps, {.i = +1 } },
47+ { MODKEY|ShiftMask, XK_o, incrovgaps, {.i = -1 } },
48 { MODKEY, XK_Return, zoom, {0} },
49 { MODKEY, XK_Tab, view, {0} },
50 { MODKEY|ShiftMask, XK_c, killclient, {0} },
51diff --git a/dwm.c b/dwm.c
52index 4465af1..88f3e04 100644
53--- a/dwm.c
54+++ b/dwm.c
55@@ -119,6 +119,10 @@ struct Monitor {
56 int by; /* bar geometry */
57 int mx, my, mw, mh; /* screen size */
58 int wx, wy, ww, wh; /* window area */
59+ int gappih; /* horizontal gap between windows */
60+ int gappiv; /* vertical gap between windows */
61+ int gappoh; /* horizontal outer gaps */
62+ int gappov; /* vertical outer gaps */
63 unsigned int seltags;
64 unsigned int sellt;
65 unsigned int tagset[2];
66@@ -199,6 +203,16 @@ static void sendmon(Client *c, Monitor *m);
67 static void setclientstate(Client *c, long state);
68 static void setfocus(Client *c);
69 static void setfullscreen(Client *c, int fullscreen);
70+static void setgaps(int oh, int ov, int ih, int iv);
71+static void incrgaps(const Arg *arg);
72+static void incrigaps(const Arg *arg);
73+static void incrogaps(const Arg *arg);
74+static void incrohgaps(const Arg *arg);
75+static void incrovgaps(const Arg *arg);
76+static void incrihgaps(const Arg *arg);
77+static void incrivgaps(const Arg *arg);
78+static void togglegaps(const Arg *arg);
79+static void defaultgaps(const Arg *arg);
80 static void setlayout(const Arg *arg);
81 static void setmfact(const Arg *arg);
82 static void setup(void);
83@@ -240,6 +254,7 @@ static char stext[256];
84 static int screen;
85 static int sw, sh; /* X display screen geometry width, height */
86 static int bh, blw = 0; /* bar geometry */
87+static int enablegaps = 1; /* enables gaps, used by togglegaps */
88 static int lrpad; /* sum of left and right padding for text */
89 static int (*xerrorxlib)(Display *, XErrorEvent *);
90 static unsigned int numlockmask = 0;
91@@ -638,6 +653,10 @@ createmon(void)
92 m->nmaster = nmaster;
93 m->showbar = showbar;
94 m->topbar = topbar;
95+ m->gappih = gappih;
96+ m->gappiv = gappiv;
97+ m->gappoh = gappoh;
98+ m->gappov = gappov;
99 m->lt[0] = &layouts[0];
100 m->lt[1] = &layouts[1 % LENGTH(layouts)];
101 strncpy(m->ltsymbol, layouts[0].symbol, sizeof m->ltsymbol);
102@@ -1498,6 +1517,111 @@ setfullscreen(Client *c, int fullscreen)
103 }
104
105 void
106+setgaps(int oh, int ov, int ih, int iv)
107+{
108+ if (oh < 0) oh = 0;
109+ if (ov < 0) ov = 0;
110+ if (ih < 0) ih = 0;
111+ if (iv < 0) iv = 0;
112+
113+ selmon->gappoh = oh;
114+ selmon->gappov = ov;
115+ selmon->gappih = ih;
116+ selmon->gappiv = iv;
117+ arrange(selmon);
118+}
119+
120+void
121+togglegaps(const Arg *arg)
122+{
123+ enablegaps = !enablegaps;
124+ arrange(selmon);
125+}
126+
127+void
128+defaultgaps(const Arg *arg)
129+{
130+ setgaps(gappoh, gappov, gappih, gappiv);
131+}
132+
133+void
134+incrgaps(const Arg *arg)
135+{
136+ setgaps(
137+ selmon->gappoh + arg->i,
138+ selmon->gappov + arg->i,
139+ selmon->gappih + arg->i,
140+ selmon->gappiv + arg->i
141+ );
142+}
143+
144+void
145+incrigaps(const Arg *arg)
146+{
147+ setgaps(
148+ selmon->gappoh,
149+ selmon->gappov,
150+ selmon->gappih + arg->i,
151+ selmon->gappiv + arg->i
152+ );
153+}
154+
155+void
156+incrogaps(const Arg *arg)
157+{
158+ setgaps(
159+ selmon->gappoh + arg->i,
160+ selmon->gappov + arg->i,
161+ selmon->gappih,
162+ selmon->gappiv
163+ );
164+}
165+
166+void
167+incrohgaps(const Arg *arg)
168+{
169+ setgaps(
170+ selmon->gappoh + arg->i,
171+ selmon->gappov,
172+ selmon->gappih,
173+ selmon->gappiv
174+ );
175+}
176+
177+void
178+incrovgaps(const Arg *arg)
179+{
180+ setgaps(
181+ selmon->gappoh,
182+ selmon->gappov + arg->i,
183+ selmon->gappih,
184+ selmon->gappiv
185+ );
186+}
187+
188+void
189+incrihgaps(const Arg *arg)
190+{
191+ setgaps(
192+ selmon->gappoh,
193+ selmon->gappov,
194+ selmon->gappih + arg->i,
195+ selmon->gappiv
196+ );
197+}
198+
199+void
200+incrivgaps(const Arg *arg)
201+{
202+ setgaps(
203+ selmon->gappoh,
204+ selmon->gappov,
205+ selmon->gappih,
206+ selmon->gappiv + arg->i
207+ );
208+}
209+
210+void
211 setlayout(const Arg *arg)
212 {
213 if (!arg || !arg->v || arg->v != selmon->lt[selmon->sellt])
214@@ -1673,26 +1797,32 @@ tagmon(const Arg *arg)
215 void
216 tile(Monitor *m)
217 {
218- unsigned int i, n, h, mw, my, ty;
219+ unsigned int i, n, h, r, oe = enablegaps, ie = enablegaps, mw, my, ty;
220 Client *c;
221
222 for (n = 0, c = nexttiled(m->clients); c; c = nexttiled(c->next), n++);
223 if (n == 0)
224 return;
225
226+ if (smartgaps == n) {
227+ oe = 0; // outer gaps disabled
228+ }
229+
230 if (n > m->nmaster)
231- mw = m->nmaster ? m->ww * m->mfact : 0;
232+ mw = m->nmaster ? (m->ww + m->gappiv*ie) * m->mfact : 0;
233 else
234- mw = m->ww;
235- for (i = my = ty = 0, c = nexttiled(m->clients); c; c = nexttiled(c->next), i++)
236+ mw = m->ww - 2*m->gappov*oe + m->gappiv*ie;
237+ for (i = 0, my = ty = m->gappoh*oe, c = nexttiled(m->clients); c; c = nexttiled(c->next), i++)
238 if (i < m->nmaster) {
239- h = (m->wh - my) / (MIN(n, m->nmaster) - i);
240- resize(c, m->wx, m->wy + my, mw - (2*c->bw), h - (2*c->bw), 0);
241- my += HEIGHT(c);
242+ r = MIN(n, m->nmaster) - i;
243+ h = (m->wh - my - m->gappoh*oe - m->gappih*ie * (r - 1)) / r;
244+ resize(c, m->wx + m->gappov*oe, m->wy + my, mw - (2*c->bw) - m->gappiv*ie, h - (2*c->bw), 0);
245+ my += HEIGHT(c) + m->gappih*ie;
246 } else {
247- h = (m->wh - ty) / (n - i);
248- resize(c, m->wx + mw, m->wy + ty, m->ww - mw - (2*c->bw), h - (2*c->bw), 0);
249- ty += HEIGHT(c);
250+ r = n - i;
251+ h = (m->wh - ty - m->gappoh*oe - m->gappih*ie * (r - 1)) / r;
252+ resize(c, m->wx + mw + m->gappov*oe, m->wy + ty, m->ww - mw - (2*c->bw) - 2*m->gappov*oe, h - (2*c->bw), 0);
253+ ty += HEIGHT(c) + m->gappih*ie;
254 }
255 }
256
257--
2582.7.4
259