sites

public wiki contents of suckless.org
git clone git://git.suckless.org/sites
Log | Files | Refs

commit 4ab106c1041344b661d5531ec18eae8849af9591
parent 83c8d8768c04734545467e3d3440f7a3425e80c5
Author: Dylan Cairns-Howarth <dairnarth@dylancairns.co.uk>
Date:   Tue,  6 Sep 2022 04:02:59 +0100

[dwm][patch][barconfig] add updated patch (c2b748e)

Updated patch fixes `'blw' undeclared` error caused by 5799dd1 (Remove
blw variable in favour of calculating the value when needed)

Diffstat:
Adwm.suckless.org/patches/barconfig/dwm-barconfig-20220906-c2b748e.diff | 183+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
Mdwm.suckless.org/patches/barconfig/index.md | 1+
2 files changed, 184 insertions(+), 0 deletions(-)

diff --git a/dwm.suckless.org/patches/barconfig/dwm-barconfig-20220906-c2b748e.diff b/dwm.suckless.org/patches/barconfig/dwm-barconfig-20220906-c2b748e.diff @@ -0,0 +1,183 @@ +From 42d79a0a4f4eee5a985a1427cd84e8dbf055e11d Mon Sep 17 00:00:00 2001 +From: Dylan Cairns-Howarth <dairnarth@dylancairns.co.uk> +Date: Tue, 6 Sep 2022 03:29:59 +0100 +Subject: [PATCH] Allow bar order to be configured in config.h + +This patch adds char *barlayout to config(.def).h which can contain as +many or as few of the characters 'l', 'n', 's', 't', or '|' to configure +the order of dwm's bar. + + l Layout indicator; + n Window name; + s Status (set with xsetroot); + t Tag indicators; + | Split point. + +Everything before '|' (and if it is omitted) will appear on the left of +the bar. Everything after will appear on the right, but in reverse +order. + +By default, this patch leaves the bar as is. +--- + config.def.h | 2 +- + dwm.c | 117 +++++++++++++++++++++++++++++++++++---------------- + 2 files changed, 81 insertions(+), 38 deletions(-) + +diff --git a/config.def.h b/config.def.h +index 061ad66..463d7f4 100644 +--- a/config.def.h ++++ b/config.def.h +@@ -5,6 +5,7 @@ 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 *barlayout = "tln|s"; + static const char *fonts[] = { "monospace:size=10" }; + static const char dmenufont[] = "monospace:size=10"; + static const char col_gray1[] = "#222222"; +@@ -112,4 +113,3 @@ static const Button buttons[] = { + { ClkTagBar, MODKEY, Button1, tag, {0} }, + { ClkTagBar, MODKEY, Button3, toggletag, {0} }, + }; +- +diff --git a/dwm.c b/dwm.c +index e5efb6a..5da79b5 100644 +--- a/dwm.c ++++ b/dwm.c +@@ -699,53 +699,96 @@ dirtomon(int dir) + void + drawbar(Monitor *m) + { +- int x, w, tw = 0; ++ int x = 0, w, tw = 0, moveright = 0; + int boxs = drw->fonts->h / 9; + int boxw = drw->fonts->h / 6 + 2; +- unsigned int i, occ = 0, urg = 0; ++ unsigned int i, j, occ = 0, urg = 0; + Client *c; + + if (!m->showbar) + return; ++ if (barlayout[0] == '\0') ++ barlayout = "tln|s"; + +- /* draw status first so it can be overdrawn by tags later */ +- 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); +- } +- +- for (c = m->clients; c; c = c->next) { +- occ |= c->tags; +- if (c->isurgent) +- urg |= c->tags; +- } +- 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); +- if (occ & 1 << i) +- drw_rect(drw, x + boxs, boxs, boxw, boxw, +- m == selmon && selmon->sel && selmon->sel->tags & 1 << i, +- urg & 1 << i); +- x += w; +- } +- w = TEXTW(m->ltsymbol); + drw_setscheme(drw, scheme[SchemeNorm]); +- x = drw_text(drw, x, 0, w, bh, lrpad / 2, m->ltsymbol, 0); +- +- 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); +- 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_text(drw, 0, 0, m->ww, bh, 0, "", 0); /* draw background */ ++ ++ for (i = 0; i < strlen(barlayout); i++) { ++ switch (barlayout[i]) { ++ case 'l': ++ w = TEXTW(m->ltsymbol); ++ drw_setscheme(drw, scheme[SchemeNorm]); ++ if (moveright) { ++ x -= w; ++ drw_text(drw, x, 0, w, bh, lrpad / 2, m->ltsymbol, 0); ++ } else ++ x = drw_text(drw, x, 0, w, bh, lrpad / 2, m->ltsymbol, 0); ++ break; ++ ++ case 'n': ++ tw = TEXTW(m->sel->name); ++ if (moveright) ++ x -= tw; ++ if (m->sel) { ++ drw_setscheme(drw, scheme[m == selmon ? SchemeSel : SchemeNorm]); ++ drw_text(drw, x, 0, moveright ? tw : m->ww, 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, tw, bh, 1, 1); ++ } ++ if (!moveright) ++ x += tw; ++ break; ++ ++ case 's': ++ if (m == selmon) { /* status is only drawn on selected monitor */ ++ drw_setscheme(drw, scheme[SchemeNorm]); ++ tw = TEXTW(stext) - lrpad + 2; /* 2px right padding */ ++ if (moveright) { ++ x -= tw; ++ drw_text(drw, x, 0, tw, bh, 0, stext, 0); ++ } else ++ x = drw_text(drw, x, 0, tw, bh, 0, stext, 0); ++ } ++ break; ++ ++ case 't': ++ for (c = m->clients; c; c = c->next) { ++ occ |= c->tags; ++ if (c->isurgent) ++ urg |= c->tags; ++ } ++ /* tags */ ++ if (moveright) { ++ tw = 0; ++ for (j = 0; j < LENGTH(tags); j++) { ++ tw += TEXTW(tags[j]); ++ } ++ x -= tw; ++ } ++ for (j = 0; j < LENGTH(tags); j++) { ++ w = TEXTW(tags[j]); ++ drw_setscheme(drw, scheme[m->tagset[m->seltags] & 1 << j ? SchemeSel : SchemeNorm]); ++ drw_text(drw, x, 0, w, bh, lrpad / 2, tags[j], urg & 1 << j); ++ if (occ & 1 << j) ++ drw_rect(drw, x + boxs, boxs, boxw, boxw, ++ m == selmon && selmon->sel && selmon->sel->tags & 1 << j, ++ urg & 1 << i); ++ x += w; ++ } ++ if (moveright) ++ x -= tw; ++ break; ++ ++ case '|': ++ moveright = 1; ++ x = m->ww; ++ break; + } + } ++ + drw_map(drw, m->barwin, 0, 0, m->ww, bh); + } + +-- +2.37.3 + diff --git a/dwm.suckless.org/patches/barconfig/index.md b/dwm.suckless.org/patches/barconfig/index.md @@ -19,6 +19,7 @@ By default, this patch leaves the bar as is. Download -------- * [dwm-barconfig-6.3.diff](dwm-barconfig-6.3.diff) (2022-02-22) +* [dwm-barconfig-20220906-c2b748e.diff](dwm-barconfig-20220906-c2b748e.diff) (2022-09-06) Author -------