From 967261bba8351e6f75939d2775a35c2ea3952c00 Mon Sep 17 00:00:00 2001 From: Bartek Stalewski Date: Sun, 21 Aug 2022 19:11:35 +0200 Subject: [PATCH] Support for empty and urgent tags. --- _desktop/_suckless/dwm/README.md | 1 + .../_patches/dwm-empty_urgent_tags-1.0.diff | 84 +++++++++++++++++++ _desktop/_suckless/dwm/config.def.h | 8 +- _desktop/_suckless/dwm/config.h | 23 +++-- _desktop/_suckless/dwm/dwm.c | 8 +- 5 files changed, 108 insertions(+), 16 deletions(-) create mode 100644 _desktop/_suckless/dwm/_patches/dwm-empty_urgent_tags-1.0.diff diff --git a/_desktop/_suckless/dwm/README.md b/_desktop/_suckless/dwm/README.md index 8f8f7a8..cd82f22 100644 --- a/_desktop/_suckless/dwm/README.md +++ b/_desktop/_suckless/dwm/README.md @@ -13,6 +13,7 @@ These patches from suckless.org were applied from the newest versions, in order: 1. `dwm-swallow-20201211-61bb8b2.diff` 1. `dwm-scratchpads-20200414-728d397b.diff` 1. `dwm-alwayscenter-20200625-f04cac6.diff` +1. `dwm-empty_urgent_tags-1.0.diff` (local, see _patches/ - use `git apply`) **note**: lot of manual work was involved, these won't apply easily on top of the others. diff --git a/_desktop/_suckless/dwm/_patches/dwm-empty_urgent_tags-1.0.diff b/_desktop/_suckless/dwm/_patches/dwm-empty_urgent_tags-1.0.diff new file mode 100644 index 0000000..430f8df --- /dev/null +++ b/_desktop/_suckless/dwm/_patches/dwm-empty_urgent_tags-1.0.diff @@ -0,0 +1,84 @@ +diff --git a/_desktop/_suckless/dwm/config.def.h b/_desktop/_suckless/dwm/config.def.h +index d4a6eee..f115171 100644 +--- a/_desktop/_suckless/dwm/config.def.h ++++ b/_desktop/_suckless/dwm/config.def.h +@@ -22,10 +22,12 @@ 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_empty[] = "#525252"; + 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 }, ++ [SchemeEmpty] = { col_empty, col_gray1, col_gray2 }, + }; + + typedef struct { +diff --git a/_desktop/_suckless/dwm/config.h b/_desktop/_suckless/dwm/config.h +index 5395cf2..5d41d54 100644 +--- a/_desktop/_suckless/dwm/config.h ++++ b/_desktop/_suckless/dwm/config.h +@@ -17,16 +17,21 @@ static const int showsystray = 1; /* 0 means no systray */ + static const int showbar = 1; /* 0 means no bar */ + static const int topbar = 1; /* 0 means bottom bar */ + static const char *fonts[] = { "RobotoMono Nerd Font:style=Medium:pixelsize=13" }; +-static const char col_fg[] = "#f8f8f2"; +-static const char col_bg[] = "#272822"; +-static const char col_bd[] = "#161616"; +-static const char col_fg_sel[] = "#ffffff"; +-static const char col_bg_sel[] = "#005577"; +-static const char col_bd_sel[] = "#707070"; ++static const char col_fg[] = "#f8f8f2"; ++static const char col_bg[] = "#272822"; ++static const char col_bd[] = "#161616"; ++static const char col_fg_empty[] = "#525252"; ++static const char col_fg_urgent[] = "#ffffff"; ++static const char col_bg_urgent[] = "#770000"; ++static const char col_fg_sel[] = "#272822"; ++static const char col_bg_sel[] = "#ffffff"; ++static const char col_bd_sel[] = "#ffffff"; + static const char *colors[][3] = { +- /* fg bg border */ +- [SchemeNorm] = { col_fg, col_bg, col_bd }, +- [SchemeSel] = { col_fg_sel, col_bg_sel, col_bd_sel }, ++ /* fg bg border */ ++ [SchemeNorm] = { col_fg, col_bg, col_bd }, ++ [SchemeSel] = { col_fg_sel, col_bg_sel, col_bd_sel }, ++ [SchemeEmpty] = { col_fg_empty, col_bg, col_bd }, ++ [SchemeUrgent] = { col_fg_urgent, col_bg_urgent, col_bd }, + }; + + typedef struct { +diff --git a/_desktop/_suckless/dwm/dwm.c b/_desktop/_suckless/dwm/dwm.c +index 8a200d5..626eab3 100644 +--- a/_desktop/_suckless/dwm/dwm.c ++++ b/_desktop/_suckless/dwm/dwm.c +@@ -81,7 +81,7 @@ + + /* enums */ + enum { CurNormal, CurResize, CurMove, CurLast }; /* cursor */ +-enum { SchemeNorm, SchemeSel }; /* color schemes */ ++enum { SchemeNorm, SchemeSel, SchemeEmpty, SchemeUrgent }; /* color schemes */ + enum { NetSupported, NetWMName, NetWMState, NetWMCheck, + NetSystemTray, NetSystemTrayOP, NetSystemTrayOrientation, NetSystemTrayOrientationHorz, + NetWMFullscreen, NetActiveWindow, NetWMWindowType, +@@ -1029,12 +1029,12 @@ drawbar(Monitor *m) + x = 0; + for (i = 0; i < LENGTH(tags); i++) { + w = TEXTW(tags[i]); +- drw_setscheme(drw, scheme[m->tagset[m->seltags] & 1 << i ? SchemeSel : SchemeNorm]); +- drw_text(drw, x, 0, w, bh, lrpad / 2, tags[i], urg & 1 << i); ++ drw_setscheme(drw, scheme[m->tagset[m->seltags] & 1 << i ? SchemeSel : urg & 1 << i ? SchemeUrgent : occ & 1 << i ? SchemeNorm : SchemeEmpty ]); ++ drw_text(drw, x, 0, w, bh, lrpad / 2, tags[i], 0); + x += w; + } + w = blw = TEXTW(m->ltsymbol); +- drw_setscheme(drw, scheme[SchemeNorm]); ++ drw_setscheme(drw, scheme[SchemeEmpty]); + x = drw_text(drw, x, 0, w, bh, lrpad / 2, m->ltsymbol, 0); + + if ((w = m->ww - tw - stw - x) > bh) { diff --git a/_desktop/_suckless/dwm/config.def.h b/_desktop/_suckless/dwm/config.def.h index d4a6eee..f115171 100644 --- a/_desktop/_suckless/dwm/config.def.h +++ b/_desktop/_suckless/dwm/config.def.h @@ -22,10 +22,12 @@ 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_empty[] = "#525252"; 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 }, + [SchemeEmpty] = { col_empty, col_gray1, col_gray2 }, }; typedef struct { diff --git a/_desktop/_suckless/dwm/config.h b/_desktop/_suckless/dwm/config.h index 5395cf2..5d41d54 100644 --- a/_desktop/_suckless/dwm/config.h +++ b/_desktop/_suckless/dwm/config.h @@ -17,16 +17,21 @@ static const int showsystray = 1; /* 0 means no systray */ static const int showbar = 1; /* 0 means no bar */ static const int topbar = 1; /* 0 means bottom bar */ static const char *fonts[] = { "RobotoMono Nerd Font:style=Medium:pixelsize=13" }; -static const char col_fg[] = "#f8f8f2"; -static const char col_bg[] = "#272822"; -static const char col_bd[] = "#161616"; -static const char col_fg_sel[] = "#ffffff"; -static const char col_bg_sel[] = "#005577"; -static const char col_bd_sel[] = "#707070"; +static const char col_fg[] = "#f8f8f2"; +static const char col_bg[] = "#272822"; +static const char col_bd[] = "#161616"; +static const char col_fg_empty[] = "#525252"; +static const char col_fg_urgent[] = "#ffffff"; +static const char col_bg_urgent[] = "#770000"; +static const char col_fg_sel[] = "#272822"; +static const char col_bg_sel[] = "#ffffff"; +static const char col_bd_sel[] = "#ffffff"; static const char *colors[][3] = { - /* fg bg border */ - [SchemeNorm] = { col_fg, col_bg, col_bd }, - [SchemeSel] = { col_fg_sel, col_bg_sel, col_bd_sel }, + /* fg bg border */ + [SchemeNorm] = { col_fg, col_bg, col_bd }, + [SchemeSel] = { col_fg_sel, col_bg_sel, col_bd_sel }, + [SchemeEmpty] = { col_fg_empty, col_bg, col_bd }, + [SchemeUrgent] = { col_fg_urgent, col_bg_urgent, col_bd }, }; typedef struct { diff --git a/_desktop/_suckless/dwm/dwm.c b/_desktop/_suckless/dwm/dwm.c index 8a200d5..626eab3 100644 --- a/_desktop/_suckless/dwm/dwm.c +++ b/_desktop/_suckless/dwm/dwm.c @@ -81,7 +81,7 @@ /* enums */ enum { CurNormal, CurResize, CurMove, CurLast }; /* cursor */ -enum { SchemeNorm, SchemeSel }; /* color schemes */ +enum { SchemeNorm, SchemeSel, SchemeEmpty, SchemeUrgent }; /* color schemes */ enum { NetSupported, NetWMName, NetWMState, NetWMCheck, NetSystemTray, NetSystemTrayOP, NetSystemTrayOrientation, NetSystemTrayOrientationHorz, NetWMFullscreen, NetActiveWindow, NetWMWindowType, @@ -1029,12 +1029,12 @@ drawbar(Monitor *m) x = 0; for (i = 0; i < LENGTH(tags); i++) { w = TEXTW(tags[i]); - drw_setscheme(drw, scheme[m->tagset[m->seltags] & 1 << i ? SchemeSel : SchemeNorm]); - drw_text(drw, x, 0, w, bh, lrpad / 2, tags[i], urg & 1 << i); + drw_setscheme(drw, scheme[m->tagset[m->seltags] & 1 << i ? SchemeSel : urg & 1 << i ? SchemeUrgent : occ & 1 << i ? SchemeNorm : SchemeEmpty ]); + drw_text(drw, x, 0, w, bh, lrpad / 2, tags[i], 0); x += w; } w = blw = TEXTW(m->ltsymbol); - drw_setscheme(drw, scheme[SchemeNorm]); + drw_setscheme(drw, scheme[SchemeEmpty]); x = drw_text(drw, x, 0, w, bh, lrpad / 2, m->ltsymbol, 0); if ((w = m->ww - tw - stw - x) > bh) {