aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--config.def.h13
-rw-r--r--config.h23
-rw-r--r--drw.c2
-rw-r--r--dwm.c28
-rw-r--r--patches/dwm-statuscolors-20220322-bece862.diff83
-rw-r--r--util.c13
6 files changed, 142 insertions, 20 deletions
diff --git a/config.def.h b/config.def.h
index 0ba8249..f22cd6a 100644
--- a/config.def.h
+++ b/config.def.h
@@ -12,10 +12,17 @@ static const char col_gray2[] = "#444444";
static const char col_gray3[] = "#bbbbbb";
static const char col_gray4[] = "#eeeeee";
static const char col_cyan[] = "#005577";
+static const char col_black[] = "#000000";
+static const char col_red[] = "#ff0000";
+static const char col_yellow[] = "#ffff00";
+static const char col_white[] = "#ffffff";
+
static const char *colors[][3] = {
- /* fg bg border */
- [SchemeNorm] = { col_gray3, col_gray1, col_gray2 },
- [SchemeSel] = { col_gray4, col_cyan, col_cyan },
+ /* fg bg border */
+ [SchemeNorm] = { col_gray3, col_gray1, col_gray2 },
+ [SchemeSel] = { col_gray4, col_cyan, col_cyan },
+ [SchemeWarn] = { col_black, col_yellow, col_red },
+ [SchemeUrgent]= { col_white, col_red, col_red },
};
/* tagging */
diff --git a/config.h b/config.h
index 7de0d4f..9a9e535 100644
--- a/config.h
+++ b/config.h
@@ -8,15 +8,21 @@ static const unsigned int borderpx = 1; /* border pixel of windows */
static const unsigned int snap = 32; /* snap pixel */
static const int showbar = 1; /* 0 means no bar */
static const int topbar = 1; /* 0 means bottom bar */
-static const char *fonts[] = { "Terminus:size=9", "monospace:size=9" };
-static const char dmenufont[] = "Terminus:size=9";
+static const char *fonts[] = { "Terminus:size=11", "monospace:size=11" };
+static const char dmenufont[] = "Terminus:size=11";
static const char col_white[] = "#ffffff";
static const char col_black[] = "#000000";
static const char col_gray[] = "#666666";
+static const char col_lightgray[] = "#cccccc";
+static const char col_red[] = "#ff0000";
+static const char col_yellow[] = "#ffff00";
static const char *colors[][3] = {
/* fg bg border */
[SchemeNorm] = { col_white, col_black, col_gray },
- [SchemeSel] = { col_black, col_white, col_white },
+ [SchemeSel] = { col_black, col_white, col_white },
+ [SchemeWarn] = { col_black, col_yellow, col_yellow },
+ [SchemeUrgent] = { col_white, col_red, col_red },
+ [SchemeNotif] = { col_black, col_lightgray, col_white },
};
/* tagging */
@@ -30,6 +36,7 @@ static const Rule rules[] = {
/* class instance title tags mask isfloating monitor */
{ "Gimp", NULL, NULL, 0, 1, -1 },
{ "Firefox", NULL, NULL, 1 << 8, 0, -1 },
+ { "Alacritty-float", NULL, NULL, 0, 1, -1 },
};
/* layout(s) */
@@ -69,10 +76,11 @@ static const char *audio_prev_cmd[] = { ".bin/ag-audio", "prev", NULL };
static const char *audio_play_cmd[] = { ".bin/ag-audio", "play", NULL };
static const char *light_increase_cmd[] = { ".bin/ag-light", "inc", NULL };
static const char *light_decrease_cmd[] = { ".bin/ag-light", "dec", NULL };
-static const char *xorg_config_cmd[] = { ".bin/x11-config", NULL };
-static const char *xorg_screen_cmd[] = { ".bin/x11-screen", NULL };
+static const char *dock_cmd[] = { ".bin/dock", NULL };
static const char *lock_suspend_cmd[] = { ".bin/ag-lock", "-s", NULL };
static const char *lock_cmd[] = { ".bin/ag-lock", NULL };
+static const char *pass_dmenu_show_cmd[] = { ".bin/ag-pass-dmenu", "show", NULL };
+static const char *pass_dmenu_totp_cmd[] = { ".bin/ag-pass-dmenu", "totp", NULL };
static Key keys[] = {
/* modifier key function argument */
@@ -114,12 +122,13 @@ static Key keys[] = {
{ MODKEY|ShiftMask, XK_Left, spawn, {.v = audio_prev_cmd } },
{ MODKEY|ShiftMask, XK_Down, spawn, {.v = audio_play_cmd } },
/* commands */
- { MODKEY|ShiftMask, XK_F8, spawn, {.v = xorg_config_cmd } },
- { MODKEY|ShiftMask, XK_F9, spawn, {.v = xorg_screen_cmd } },
+ { MODKEY|ShiftMask, XK_F11, spawn, {.v = dock_cmd } },
{ MODKEY|ShiftMask, XK_F12, spawn, {.v = lock_suspend_cmd } },
{ MODKEY, XK_F12, spawn, {.v = lock_cmd } },
{ MODKEY, XK_Return, spawn, {.v = termcmd } },
{ MODKEY, XK_d, spawn, {.v = dmenucmd } },
+ { MODKEY, XK_p, spawn, {.v = pass_dmenu_show_cmd } },
+ { MODKEY, XK_o, spawn, {.v = pass_dmenu_totp_cmd } },
/* tags */
TAGKEYS( XK_1, 0)
TAGKEYS( XK_2, 1)
diff --git a/drw.c b/drw.c
index 344de61..c41e6af 100644
--- a/drw.c
+++ b/drw.c
@@ -248,6 +248,8 @@ drw_text(Drw *drw, int x, int y, unsigned int w, unsigned int h, unsigned int lp
} else {
XSetForeground(drw->dpy, drw->gc, drw->scheme[invert ? ColFg : ColBg].pixel);
XFillRectangle(drw->dpy, drw->drawable, drw->gc, x, y, w, h);
+ if (w < lpad)
+ return x + w;
d = XftDrawCreate(drw->dpy, drw->drawable,
DefaultVisual(drw->dpy, drw->screen),
DefaultColormap(drw->dpy, drw->screen));
diff --git a/dwm.c b/dwm.c
index 6b5503a..8e97bd4 100644
--- a/dwm.c
+++ b/dwm.c
@@ -58,7 +58,7 @@
/* enums */
enum { CurNormal, CurResize, CurMove, CurLast }; /* cursor */
-enum { SchemeNorm, SchemeSel }; /* color schemes */
+enum { SchemeNorm, SchemeSel, SchemeWarn, SchemeUrgent, SchemeNotif }; /* color schemes */
enum { NetSupported, NetWMName, NetWMState, NetWMCheck,
NetWMFullscreen, NetActiveWindow, NetWMWindowType,
NetWMWindowTypeDialog, NetClientList, NetLast }; /* EWMH atoms */
@@ -729,7 +729,17 @@ drawbar(Monitor *m)
int boxs = drw->fonts->h / 9;
int boxw = drw->fonts->h / 6 + 2;
unsigned int i, occ = 0, urg = 0;
+ char *ts = stext;
+ char *tp = stext;
+ int tx = 0;
+ char ctmp;
Client *c;
+ int correct = 0; /* correction for colours */
+
+ for ( ; *ts != '\0' ; ts++)
+ if (*ts <= LENGTH(colors))
+ correct += TEXTW("A") - lrpad;
+ ts = stext;
if (!m->showbar)
return;
@@ -738,7 +748,17 @@ drawbar(Monitor *m)
if (m == selmon || 1) { /* status is only drawn on selected monitor */
drw_setscheme(drw, scheme[SchemeNorm]);
tw = TEXTW(stext) - lrpad + 2; /* 2px right padding */
- drw_text(drw, m->ww - tw, 0, tw, bh, 0, stext, 0);
+ while (1) {
+ if ((unsigned int)*ts > LENGTH(colors)) { ts++; continue ; }
+ ctmp = *ts;
+ *ts = '\0';
+ drw_text(drw, m->ww - tw + tx + correct, 0, tw - tx - correct, bh, 0, tp, 0);
+ tx += TEXTW(tp) -lrpad;
+ if (ctmp == '\0') { break; }
+ drw_setscheme(drw, scheme[(unsigned int)(ctmp-1)]);
+ *ts = ctmp;
+ tp = ++ts;
+ }
}
for (c = m->clients; c; c = c->next) {
@@ -764,12 +784,12 @@ drawbar(Monitor *m)
if ((w = m->ww - tw - x) > bh) {
if (m->sel) {
drw_setscheme(drw, scheme[m == selmon ? SchemeSel : SchemeNorm]);
- drw_text(drw, x, 0, w, bh, lrpad / 2, m->sel->name, 0);
+ drw_text(drw, x, 0, w + correct, bh, lrpad / 2, m->sel->name, 0);
if (m->sel->isfloating)
drw_rect(drw, x + boxs, boxs, boxw, boxw, m->sel->isfixed, 0);
} else {
drw_setscheme(drw, scheme[SchemeNorm]);
- drw_rect(drw, x, 0, w, bh, 1, 1);
+ drw_rect(drw, x, 0, w + correct, bh, 1, 1);
}
}
drw_map(drw, m->barwin, 0, 0, m->ww, bh);
diff --git a/patches/dwm-statuscolors-20220322-bece862.diff b/patches/dwm-statuscolors-20220322-bece862.diff
new file mode 100644
index 0000000..2425419
--- /dev/null
+++ b/patches/dwm-statuscolors-20220322-bece862.diff
@@ -0,0 +1,83 @@
+From 301db3986527041d64f4b58026677709a34b153f Mon Sep 17 00:00:00 2001
+From: dan soucy <dev@danso.ca>
+Date: Tue, 22 Mar 2022 03:15:00 -0400
+Subject: [PATCH] enable colored text in the status bar
+
+This patch is an update of statuscolors patch to work with 6.3.
+It is known to work up to commit bece862.
+---
+ config.def.h | 13 ++++++++++---
+ dwm.c | 18 ++++++++++++++++--
+ 2 files changed, 26 insertions(+), 5 deletions(-)
+
+diff --git a/config.def.h b/config.def.h
+index a2ac963..a635f76 100644
+--- a/config.def.h
++++ b/config.def.h
+@@ -12,10 +12,17 @@ static const char col_gray2[] = "#444444";
+ static const char col_gray3[] = "#bbbbbb";
+ static const char col_gray4[] = "#eeeeee";
+ static const char col_cyan[] = "#005577";
++static const char col_black[] = "#000000";
++static const char col_red[] = "#ff0000";
++static const char col_yellow[] = "#ffff00";
++static const char col_white[] = "#ffffff";
++
+ static const char *colors[][3] = {
+- /* fg bg border */
+- [SchemeNorm] = { col_gray3, col_gray1, col_gray2 },
+- [SchemeSel] = { col_gray4, col_cyan, col_cyan },
++ /* fg bg border */
++ [SchemeNorm] = { col_gray3, col_gray1, col_gray2 },
++ [SchemeSel] = { col_gray4, col_cyan, col_cyan },
++ [SchemeWarn] = { col_black, col_yellow, col_red },
++ [SchemeUrgent]= { col_white, col_red, col_red },
+ };
+
+ /* tagging */
+diff --git a/dwm.c b/dwm.c
+index 5f16260..3c5e26b 100644
+--- a/dwm.c
++++ b/dwm.c
+@@ -59,7 +59,7 @@
+
+ /* enums */
+ enum { CurNormal, CurResize, CurMove, CurLast }; /* cursor */
+-enum { SchemeNorm, SchemeSel }; /* color schemes */
++enum { SchemeNorm, SchemeSel, SchemeWarn, SchemeUrgent }; /* color schemes */
+ enum { NetSupported, NetWMName, NetWMState, NetWMCheck,
+ NetWMFullscreen, NetActiveWindow, NetWMWindowType,
+ NetWMWindowTypeDialog, NetClientList, NetLast }; /* EWMH atoms */
+@@ -701,6 +701,10 @@ drawbar(Monitor *m)
+ int boxs = drw->fonts->h / 9;
+ int boxw = drw->fonts->h / 6 + 2;
+ unsigned int i, occ = 0, urg = 0;
++ char *ts = stext;
++ char *tp = stext;
++ int tx = 0;
++ char ctmp;
+ Client *c;
+
+ if (!m->showbar)
+@@ -710,7 +714,17 @@ drawbar(Monitor *m)
+ if (m == selmon) { /* status is only drawn on selected monitor */
+ drw_setscheme(drw, scheme[SchemeNorm]);
+ tw = TEXTW(stext) - lrpad + 2; /* 2px right padding */
+- drw_text(drw, m->ww - tw, 0, tw, bh, 0, stext, 0);
++ while (1) {
++ if ((unsigned int)*ts > LENGTH(colors)) { ts++; continue ; }
++ ctmp = *ts;
++ *ts = '\0';
++ drw_text(drw, m->ww - tw + tx, 0, tw - tx, bh, 0, tp, 0);
++ tx += TEXTW(tp) -lrpad;
++ if (ctmp == '\0') { break; }
++ drw_setscheme(drw, scheme[(unsigned int)(ctmp-1)]);
++ *ts = ctmp;
++ tp = ++ts;
++ }
+ }
+
+ for (c = m->clients; c; c = c->next) {
+--
+2.35.1
+
diff --git a/util.c b/util.c
index 96b82c9..8e26a51 100644
--- a/util.c
+++ b/util.c
@@ -1,4 +1,5 @@
/* See LICENSE file for copyright and license details. */
+#include <errno.h>
#include <stdarg.h>
#include <stdio.h>
#include <stdlib.h>
@@ -10,17 +11,17 @@ void
die(const char *fmt, ...)
{
va_list ap;
+ int saved_errno;
+
+ saved_errno = errno;
va_start(ap, fmt);
vfprintf(stderr, fmt, ap);
va_end(ap);
- if (fmt[0] && fmt[strlen(fmt)-1] == ':') {
- fputc(' ', stderr);
- perror(NULL);
- } else {
- fputc('\n', stderr);
- }
+ if (fmt[0] && fmt[strlen(fmt)-1] == ':')
+ fprintf(stderr, " %s", strerror(saved_errno));
+ fputc('\n', stderr);
exit(1);
}
remember that computers suck.