added statuscolors patch

This commit is contained in:
Ryan Kes 2019-02-25 17:42:13 +01:00
parent db18817700
commit bed2767b7f
3 changed files with 96 additions and 5 deletions

View file

@ -21,6 +21,7 @@ _patches=(
"https://dwm.suckless.org/patches/gridmode/dwm-gridmode-20170909-ceac8c9.diff" "https://dwm.suckless.org/patches/gridmode/dwm-gridmode-20170909-ceac8c9.diff"
"https://dwm.suckless.org/patches/selfrestart/dwm-r1615-selfrestart.diff" "https://dwm.suckless.org/patches/selfrestart/dwm-r1615-selfrestart.diff"
"local-hide_vacant_tags-git-20160626-7af4d43.diff" "local-hide_vacant_tags-git-20160626-7af4d43.diff"
"local-statuscolors-20181008-b69c870.diff"
) )
source=(http://dl.suckless.org/dwm/dwm-$pkgver.tar.gz source=(http://dl.suckless.org/dwm/dwm-$pkgver.tar.gz
@ -29,7 +30,7 @@ source=(http://dl.suckless.org/dwm/dwm-$pkgver.tar.gz
"${_patches[@]}") "${_patches[@]}")
md5sums=('9929845ccdec4d2cc191f16210dd7f3d' md5sums=('9929845ccdec4d2cc191f16210dd7f3d'
'ecec97229adfaa98ebeb99b0e45df173' '1ab8724d280adc82681e481b11d410dd'
'939f403a71b6e85261d09fc3412269ee' '939f403a71b6e85261d09fc3412269ee'
'2c19f1a3db59e158c45483668f4cee24' '2c19f1a3db59e158c45483668f4cee24'
'fbb786263f2d714b18368ff64779d669' 'fbb786263f2d714b18368ff64779d669'
@ -38,7 +39,8 @@ md5sums=('9929845ccdec4d2cc191f16210dd7f3d'
'5baffd8c124095d06b133e9b31a854b2' '5baffd8c124095d06b133e9b31a854b2'
'6055775113fd4dc06200bc6aaafb72fb' '6055775113fd4dc06200bc6aaafb72fb'
'aa3d5f3c45057a2a6ee73aede3fc218a' 'aa3d5f3c45057a2a6ee73aede3fc218a'
'032fb87c8c13fae43433c098d44b9070') 'd2781ac29048fc50e42e0f11e6cf7bce'
'c5469c1457955a8447e05ec5118b3ce6')
prepare() { prepare() {
cd $srcdir/$pkgname-$pkgver cd $srcdir/$pkgname-$pkgver

View file

@ -16,10 +16,16 @@ static const char col_gray2[] = "#444444";
static const char col_gray3[] = "#bbbbbb"; static const char col_gray3[] = "#bbbbbb";
static const char col_gray4[] = "#eeeeee"; static const char col_gray4[] = "#eeeeee";
static const char col_cyan[] = "#005577"; 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] = { static const char *colors[][3] = {
/* fg bg border */ /* fg bg border */
[SchemeNorm] = { col_gray3, col_gray1, col_gray2 }, [SchemeNorm] = { col_gray3, col_gray1, col_gray2 },
[SchemeSel] = { col_gray4, col_cyan, col_cyan }, [SchemeSel] = { col_gray4, col_cyan, col_cyan },
[SchemeWarn] = { col_black, col_yellow, col_red },
[SchemeUrgent]= { col_white, col_red, col_red },
}; };
/* tagging */ /* tagging */

View file

@ -0,0 +1,83 @@
From 35418d156fccb922710f6ca80a1f3972ba88b42f Mon Sep 17 00:00:00 2001
From: Danny O'Brien <danny@spesh.com>
Date: Mon, 8 Oct 2018 19:21:29 -0700
Subject: [PATCH] Add colors to status message in bar.
This patch matches the format used by
https://dwm.suckless.org/patches/statuscolors/ -- An \x01 character
switches to the normal foreground/color combo, \x02 switches to the
color combo used for selected tags, \03 is set by default to black on
yellow, \04 is white on red.
These color settings are defined in the colors array in config.def.h.
More can be added, but don't have more than 32, or you'll start hitting
real ASCII.
This applies cleanly on mainline dwm from commit 022d076 (Sat Jan 7
17:21:29 2017 +0100) until at least b69c870 (Sat Jun 2 17:15:42 2018
+020).
---
diff --git a/config.def.h b/config.def.h
@@ -16,10 +16,17 @@ static const char col_gray2[] = "#
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
@@ -76,7 +76,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,
NetSystemTray, NetSystemTrayOP, NetSystemTrayOrientation, NetSystemTrayOrientationHorz,
NetWMFullscreen, NetActiveWindow, NetWMWindowType,
@@ -826,6 +826,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(showsystray && m == systraytomon(m))
@@ -835,7 +839,17 @@ drawbar(Monitor *m)
if (m == selmon) { /* status is only drawn on selected monitor */
drw_setscheme(drw, scheme[SchemeNorm]);
sw = TEXTW(stext) - lrpad / 2 + 2; /* 2px right padding */
- drw_text(drw, m->ww - sw - stw, 0, sw, bh, lrpad / 2 - 2, stext, 0);
+ while (1) {
+ if ((unsigned int)*ts > LENGTH(colors)) { ts++; continue ; }
+ ctmp = *ts;
+ *ts = '\0';
+ drw_text(drw, m->ww - sw + tx, 0, sw - 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;
+ }
}
resizebarwin(m);