summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--dwm/config.h47
-rwxr-xr-xdwm/dwmbar8
-rw-r--r--dwm/patches/dwm-status2d-20200508-60bb3df.diff180
-rw-r--r--dwm/patches/dwm-statuscolors-20181008-b69c870.diff94
4 files changed, 200 insertions, 129 deletions
diff --git a/dwm/config.h b/dwm/config.h
index 0674870..11f6c81 100644
--- a/dwm/config.h
+++ b/dwm/config.h
@@ -3,30 +3,23 @@
3/* appearance */ 3/* appearance */
4static const unsigned int borderpx = 0; /* 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 */ 6static const unsigned int gappih = 10; /* horiz inner gap between windows */
7static const unsigned int gappiv = 8; /* vert inner gap between windows */ 7static const unsigned int gappiv = 10; /* vert inner gap between windows */
8static const unsigned int gappoh = 8; /* horiz outer gap between windows and screen edge */ 8static const unsigned int gappoh = 10; /* horiz outer gap between windows and screen edge */
9static const unsigned int gappov = 8; /* vert outer gap between windows and screen edge */ 9static const unsigned int gappov = 10; /* vert outer gap between windows and screen edge */
10static const int smartgaps = 0; /* 1 means no outer gap when there is only one window */ 10static const int smartgaps = 0; /* 1 means no outer gap when there is only one window */
11static const int showbar = 1; /* 0 means no bar */ 11static const int showbar = 1; /* 0 means no bar */
12static const int topbar = 1; /* 0 means bottom bar */ 12static const int topbar = 1; /* 0 means bottom bar */
13static const char *fonts[] = { "Hermit:pixelsize=11:antialias=true:autohint=true" }; 13static const char *fonts[] = { "Hermit:pixelsize=12.5:antialias=true:autohint=true" };
14static const char col_gray1[] = "#696969"; 14static const char col_gray1[] = "#696969";
15static const char col_gray2[] = "#000000"; 15static const char col_gray2[] = "#000000";
16static const char col_gray3[] = "#c6c8d1"; 16static const char col_gray3[] = "#c6c8d1";
17static const char col_gray4[] = "#696969"; 17static const char col_gray4[] = "#696969";
18static const char col_cyan[] = "#e0e0e0"; 18static const char col_cyan[] = "#e0e0e0";
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#define NUMCOLORS 4
24static const char *colors[][3] = { 19static const char *colors[][3] = {
25 /* fg bg border */ 20 /* fg bg border */
26 [SchemeNorm] = { col_gray4, col_gray2, col_gray2 }, 21 [SchemeNorm] = { col_gray4, col_gray2, col_gray2 },
27 [SchemeSel] = { col_gray3, col_gray2, col_gray2 }, 22 [SchemeSel] = { col_gray3, col_gray2, col_gray2},
28 [SchemeWarn] = { col_black, col_yellow, col_red },
29 [SchemeUrgent]= { col_white, col_red, col_red },
30}; 23};
31 24
32/* tagging */ 25/* tagging */
@@ -45,7 +38,7 @@ static const Rule rules[] = {
45/* layout(s) */ 38/* layout(s) */
46static const float mfact = 0.50; /* factor of master area size [0.05..0.95] */ 39static const float mfact = 0.50; /* factor of master area size [0.05..0.95] */
47static const int nmaster = 1; /* number of clients in master area */ 40static const int nmaster = 1; /* number of clients in master area */
48static const int resizehints = 0; /* 1 means respect size hints in tiled resizals */ 41static const int resizehints = 1; /* 1 means respect size hints in tiled resizals */
49 42
50static const Layout layouts[] = { 43static const Layout layouts[] = {
51 /* symbol arrange function */ 44 /* symbol arrange function */
@@ -70,7 +63,7 @@ static char dmenumon[2] = "0"; /* component of dmenucmd, manipulated in spawn()
70static const char *dmenucmd[] = { "menu", NULL }; 63static const char *dmenucmd[] = { "menu", NULL };
71static const char *termcmd[] = { "st", NULL }; 64static const char *termcmd[] = { "st", NULL };
72static const char scratchpadname[] = "scratchpad"; 65static const char scratchpadname[] = "scratchpad";
73static const char *scratchpadcmd[] = { "st", "-t", scratchpadname, "-g", "80x24", NULL }; 66static const char *scratchpadcmd[] = { "st", "-t", scratchpadname, "-g", "120x34", NULL };
74 67
75/* volume */ 68/* volume */
76static const char *upvol[] = { "pulsemixer", "--change-volume", "+5", NULL }; 69static const char *upvol[] = { "pulsemixer", "--change-volume", "+5", NULL };
@@ -82,11 +75,6 @@ static const char *shut[] = { "shut", NULL };
82static const char *brightup[] = { "doas", "bup", NULL }; 75static const char *brightup[] = { "doas", "bup", NULL };
83static const char *brightdown[] = { "doas", "bdown", NULL }; 76static const char *brightdown[] = { "doas", "bdown", NULL };
84 77
85/* cmus */
86static const char *plyrnext[] = { "cmus-remote", "-n", NULL };
87static const char *plyrprev[] = { "cmus-remote", "-r", NULL };
88static const char *plyrplay[] = { "cmus-remote", "-u", NULL };
89
90/* lock */ 78/* lock */
91static const char *lock[] = { "xset", "s", "activate", NULL }; 79static const char *lock[] = { "xset", "s", "activate", NULL };
92 80
@@ -101,9 +89,6 @@ static Key keys[] = {
101 { 0, XF86XK_AudioRaiseVolume, spawn, {.v = upvol } }, 89 { 0, XF86XK_AudioRaiseVolume, spawn, {.v = upvol } },
102 { 0, XF86XK_MonBrightnessUp, spawn, {.v = brightup } }, 90 { 0, XF86XK_MonBrightnessUp, spawn, {.v = brightup } },
103 { 0, XF86XK_MonBrightnessDown, spawn, {.v = brightdown } }, 91 { 0, XF86XK_MonBrightnessDown, spawn, {.v = brightdown } },
104 { 0, XF86XK_AudioNext, spawn, {.v = plyrnext } },
105 { 0, XF86XK_AudioPrev, spawn, {.v = plyrprev } },
106 { 0, XF86XK_AudioPlay, spawn, {.v = plyrplay } },
107 { MODKEY|ShiftMask, XK_Delete, spawn, {.v = lock } }, 92 { MODKEY|ShiftMask, XK_Delete, spawn, {.v = lock } },
108 { MODKEY, XK_b, togglebar, {0} }, 93 { MODKEY, XK_b, togglebar, {0} },
109 { MODKEY, XK_j, focusstack, {.i = +1 } }, 94 { MODKEY, XK_j, focusstack, {.i = +1 } },
@@ -112,14 +97,14 @@ static Key keys[] = {
112 { MODKEY, XK_d, incnmaster, {.i = -1 } }, 97 { MODKEY, XK_d, incnmaster, {.i = -1 } },
113 { MODKEY, XK_h, setmfact, {.f = -0.05} }, 98 { MODKEY, XK_h, setmfact, {.f = -0.05} },
114 { MODKEY, XK_l, setmfact, {.f = +0.05} }, 99 { MODKEY, XK_l, setmfact, {.f = +0.05} },
115 { MODKEY|Mod1Mask, XK_h, incrgaps, {.i = +1 } }, 100 { MODKEY|Mod4Mask, XK_h, incrgaps, {.i = +1 } },
116 { MODKEY|Mod1Mask, XK_l, incrgaps, {.i = -1 } }, 101 { MODKEY|Mod4Mask, XK_l, incrgaps, {.i = -1 } },
117 { MODKEY|Mod1Mask|ShiftMask, XK_h, incrogaps, {.i = +1 } }, 102 { MODKEY|Mod4Mask|ShiftMask, XK_h, incrogaps, {.i = +1 } },
118 { MODKEY|Mod1Mask|ShiftMask, XK_l, incrogaps, {.i = -1 } }, 103 { MODKEY|Mod4Mask|ShiftMask, XK_l, incrogaps, {.i = -1 } },
119 { MODKEY|Mod1Mask|ControlMask, XK_h, incrigaps, {.i = +1 } }, 104 { MODKEY|Mod4Mask|ControlMask, XK_h, incrigaps, {.i = +1 } },
120 { MODKEY|Mod1Mask|ControlMask, XK_l, incrigaps, {.i = -1 } }, 105 { MODKEY|Mod4Mask|ControlMask, XK_l, incrigaps, {.i = -1 } },
121 { MODKEY|Mod1Mask, XK_0, togglegaps, {0} }, 106 { MODKEY|Mod4Mask, XK_0, togglegaps, {0} },
122 { MODKEY|Mod1Mask|ShiftMask, XK_0, defaultgaps, {0} }, 107 { MODKEY|Mod4Mask|ShiftMask, XK_0, defaultgaps, {0} },
123 { MODKEY, XK_y, incrihgaps, {.i = +1 } }, 108 { MODKEY, XK_y, incrihgaps, {.i = +1 } },
124 { MODKEY, XK_o, incrihgaps, {.i = -1 } }, 109 { MODKEY, XK_o, incrihgaps, {.i = -1 } },
125 { MODKEY|ControlMask, XK_y, incrivgaps, {.i = +1 } }, 110 { MODKEY|ControlMask, XK_y, incrivgaps, {.i = +1 } },
diff --git a/dwm/dwmbar b/dwm/dwmbar
index d9e92ca..0960930 100755
--- a/dwm/dwmbar
+++ b/dwm/dwmbar
@@ -1,22 +1,22 @@
1#!/bin/bash 1#!/bin/bash
2vol(){ 2vol(){
3 vol=$(pulsemixer --get-volume | awk '{print $1}') 3 vol=$(pulsemixer --get-volume | awk '{print $1}')
4 echo -e "\x01vol \x02$vol%" 4 printf "%s" "vol ^c#c6c8d1^$vol%^d^"
5} 5}
6 6
7bat() { 7bat() {
8 power=$(cat /sys/class/power_supply/BAT0/capacity) 8 power=$(cat /sys/class/power_supply/BAT0/capacity)
9 echo -e "\x01bat \x02$power%" 9 printf "%s" "bat ^c#c6c8d1^$power%^d^"
10} 10}
11 11
12dte() { 12dte() {
13 dte=$(date +"%A, %B %d") 13 dte=$(date +"%A, %B %d")
14 echo -e "\x01date \x02$dte" 14 printf "%s" "date ^c#c6c8d1^$dte^d^"
15} 15}
16 16
17tie() { 17tie() {
18 tme=$(date +"%I:%M %p") 18 tme=$(date +"%I:%M %p")
19 echo -e "\x01time \x02$tme" 19 printf "%s" "time ^c#c6c8d1^$tme^d^"
20} 20}
21while true; do 21while true; do
22 xsetroot -name "$(vol) $(bat) $(tie) $(dte)" 22 xsetroot -name "$(vol) $(bat) $(tie) $(dte)"
diff --git a/dwm/patches/dwm-status2d-20200508-60bb3df.diff b/dwm/patches/dwm-status2d-20200508-60bb3df.diff
new file mode 100644
index 0000000..6f353fd
--- /dev/null
+++ b/dwm/patches/dwm-status2d-20200508-60bb3df.diff
@@ -0,0 +1,180 @@
1From 60bb3dfaf91227eb02e828d74e6f4758b2c56542 Mon Sep 17 00:00:00 2001
2From: cultab <rroarck@gmail.com>
3Date: Fri, 8 May 2020 13:56:08 +0300
4Subject: [PATCH] fix status2d to work after ed3ab6
5
6ed3ab6 changed the name of the variable sw to tw, now the patch won't apply nor work.
7This patch updates the variable name to the new one.
8---
9 dwm.c | 120 +++++++++++++++++++++++++++++++++++++++++++++++++++++++---
10 1 file changed, 114 insertions(+), 6 deletions(-)
11
12diff --git a/dwm.c b/dwm.c
13index 9fd0286..71e18be 100644
14--- a/dwm.c
15+++ b/dwm.c
16@@ -163,6 +163,7 @@ static void detachstack(Client *c);
17 static Monitor *dirtomon(int dir);
18 static void drawbar(Monitor *m);
19 static void drawbars(void);
20+static int drawstatusbar(Monitor *m, int bh, char* text);
21 static void enternotify(XEvent *e);
22 static void expose(XEvent *e);
23 static void focus(Client *c);
24@@ -237,7 +238,7 @@ static void zoom(const Arg *arg);
25
26 /* variables */
27 static const char broken[] = "broken";
28-static char stext[256];
29+static char stext[1024];
30 static int screen;
31 static int sw, sh; /* X display screen geometry width, height */
32 static int bh, blw = 0; /* bar geometry */
33@@ -485,7 +486,7 @@ cleanup(void)
34 cleanupmon(mons);
35 for (i = 0; i < CurLast; i++)
36 drw_cur_free(drw, cursor[i]);
37- for (i = 0; i < LENGTH(colors); i++)
38+ for (i = 0; i < LENGTH(colors) + 1; i++)
39 free(scheme[i]);
40 XDestroyWindow(dpy, wmcheckwin);
41 drw_free(drw);
42@@ -693,6 +694,114 @@ dirtomon(int dir)
43 return m;
44 }
45
46+int
47+drawstatusbar(Monitor *m, int bh, char* stext) {
48+ int ret, i, w, x, len;
49+ short isCode = 0;
50+ char *text;
51+ char *p;
52+
53+ len = strlen(stext) + 1 ;
54+ if (!(text = (char*) malloc(sizeof(char)*len)))
55+ die("malloc");
56+ p = text;
57+ memcpy(text, stext, len);
58+
59+ /* compute width of the status text */
60+ w = 0;
61+ i = -1;
62+ while (text[++i]) {
63+ if (text[i] == '^') {
64+ if (!isCode) {
65+ isCode = 1;
66+ text[i] = '\0';
67+ w += TEXTW(text) - lrpad;
68+ text[i] = '^';
69+ if (text[++i] == 'f')
70+ w += atoi(text + ++i);
71+ } else {
72+ isCode = 0;
73+ text = text + i + 1;
74+ i = -1;
75+ }
76+ }
77+ }
78+ if (!isCode)
79+ w += TEXTW(text) - lrpad;
80+ else
81+ isCode = 0;
82+ text = p;
83+
84+ w += 2; /* 1px padding on both sides */
85+ ret = x = m->ww - w;
86+
87+ drw_setscheme(drw, scheme[LENGTH(colors)]);
88+ drw->scheme[ColFg] = scheme[SchemeNorm][ColFg];
89+ drw->scheme[ColBg] = scheme[SchemeNorm][ColBg];
90+ drw_rect(drw, x, 0, w, bh, 1, 1);
91+ x++;
92+
93+ /* process status text */
94+ i = -1;
95+ while (text[++i]) {
96+ if (text[i] == '^' && !isCode) {
97+ isCode = 1;
98+
99+ text[i] = '\0';
100+ w = TEXTW(text) - lrpad;
101+ drw_text(drw, x, 0, w, bh, 0, text, 0);
102+
103+ x += w;
104+
105+ /* process code */
106+ while (text[++i] != '^') {
107+ if (text[i] == 'c') {
108+ char buf[8];
109+ memcpy(buf, (char*)text+i+1, 7);
110+ buf[7] = '\0';
111+ drw_clr_create(drw, &drw->scheme[ColFg], buf);
112+ i += 7;
113+ } else if (text[i] == 'b') {
114+ char buf[8];
115+ memcpy(buf, (char*)text+i+1, 7);
116+ buf[7] = '\0';
117+ drw_clr_create(drw, &drw->scheme[ColBg], buf);
118+ i += 7;
119+ } else if (text[i] == 'd') {
120+ drw->scheme[ColFg] = scheme[SchemeNorm][ColFg];
121+ drw->scheme[ColBg] = scheme[SchemeNorm][ColBg];
122+ } else if (text[i] == 'r') {
123+ int rx = atoi(text + ++i);
124+ while (text[++i] != ',');
125+ int ry = atoi(text + ++i);
126+ while (text[++i] != ',');
127+ int rw = atoi(text + ++i);
128+ while (text[++i] != ',');
129+ int rh = atoi(text + ++i);
130+
131+ drw_rect(drw, rx + x, ry, rw, rh, 1, 0);
132+ } else if (text[i] == 'f') {
133+ x += atoi(text + ++i);
134+ }
135+ }
136+
137+ text = text + i + 1;
138+ i=-1;
139+ isCode = 0;
140+ }
141+ }
142+
143+ if (!isCode) {
144+ w = TEXTW(text) - lrpad;
145+ drw_text(drw, x, 0, w, bh, 0, text, 0);
146+ }
147+
148+ drw_setscheme(drw, scheme[SchemeNorm]);
149+ free(p);
150+
151+ return ret;
152+}
153+
154 void
155 drawbar(Monitor *m)
156 {
157@@ -704,9 +813,7 @@ drawbar(Monitor *m)
158
159 /* draw status first so it can be overdrawn by tags later */
160 if (m == selmon) { /* status is only drawn on selected monitor */
161- drw_setscheme(drw, scheme[SchemeNorm]);
162- tw = TEXTW(stext) - lrpad + 2; /* 2px right padding */
163- drw_text(drw, m->ww - tw, 0, tw, bh, 0, stext, 0);
164+ tw = m->ww - drawstatusbar(m, bh, stext);
165 }
166
167 for (c = m->clients; c; c = c->next) {
168@@ -1568,7 +1675,8 @@ setup(void)
169 cursor[CurResize] = drw_cur_create(drw, XC_sizing);
170 cursor[CurMove] = drw_cur_create(drw, XC_fleur);
171 /* init appearance */
172- scheme = ecalloc(LENGTH(colors), sizeof(Clr *));
173+ scheme = ecalloc(LENGTH(colors) + 1, sizeof(Clr *));
174+ scheme[LENGTH(colors)] = drw_scm_create(drw, colors[0], 3);
175 for (i = 0; i < LENGTH(colors); i++)
176 scheme[i] = drw_scm_create(drw, colors[i], 3);
177 /* init bars */
178--
1792.26.2
180
diff --git a/dwm/patches/dwm-statuscolors-20181008-b69c870.diff b/dwm/patches/dwm-statuscolors-20181008-b69c870.diff
deleted file mode 100644
index 8c7869a..0000000
--- a/dwm/patches/dwm-statuscolors-20181008-b69c870.diff
+++ /dev/null
@@ -1,94 +0,0 @@
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