diff options
Diffstat (limited to 'patches/dwm-splitstatus-20201114-61bb8b2.diff')
| -rw-r--r-- | patches/dwm-splitstatus-20201114-61bb8b2.diff | 77 |
1 files changed, 77 insertions, 0 deletions
diff --git a/patches/dwm-splitstatus-20201114-61bb8b2.diff b/patches/dwm-splitstatus-20201114-61bb8b2.diff new file mode 100644 index 0000000..0f1130c --- /dev/null +++ b/patches/dwm-splitstatus-20201114-61bb8b2.diff @@ -0,0 +1,77 @@ +From d2efb5e19eb466f77f0860f0175b84247799bb93 Mon Sep 17 00:00:00 2001 +From: Alex Cole <ajzcole@airmail.cc> +Date: Sat, 14 Nov 2020 21:03:09 +1300 +Subject: [PATCH] splitstatus patch + +--- + config.def.h | 2 ++ + dwm.c | 31 +++++++++++++++---------------- + 2 files changed, 17 insertions(+), 16 deletions(-) + +diff --git a/config.def.h b/config.def.h +index 1c0b587..4161652 100644 +--- a/config.def.h ++++ b/config.def.h +@@ -5,6 +5,8 @@ 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 int splitstatus = 1; /* 1 for split status items */ ++static const char *splitdelim = ";"; /* Character used for separating status */ + static const char *fonts[] = { "monospace:size=10" }; + static const char dmenufont[] = "monospace:size=10"; + static const char col_gray1[] = "#222222"; +diff --git a/dwm.c b/dwm.c +index 664c527..e1a8085 100644 +--- a/dwm.c ++++ b/dwm.c +@@ -701,13 +701,9 @@ drawbar(Monitor *m) + int boxw = drw->fonts->h / 6 + 2; + unsigned int i, occ = 0, urg = 0; + Client *c; +- +- /* 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); +- } ++ char *mstext; ++ char *rstext; ++ int msx; + + for (c = m->clients; c; c = c->next) { + occ |= c->tags; +@@ -729,17 +725,20 @@ drawbar(Monitor *m) + 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_setscheme(drw, scheme[SchemeNorm]); ++ drw_rect(drw, x, 0, m->ww - x, bh, 1, 1); ++ ++ if (m == selmon) { /* status is only drawn on selected monitor */ ++ rstext = strdup(stext); ++ if (splitstatus) { ++ mstext = strsep(&rstext, splitdelim); ++ msx = (m->ww - TEXTW(mstext) + lrpad) / 2; /* x position of middle status text */ ++ drw_text(drw, msx, 0, TEXTW(mstext) - lrpad, bh, 0, mstext, 0); + } ++ tw = TEXTW(rstext) - lrpad + 2; /* 2px right padding */ ++ drw_text(drw, m->ww - tw, 0, tw, bh, 0, rstext, 0); + } ++ + drw_map(drw, m->barwin, 0, 0, m->ww, bh); + } + +-- +2.29.2 + |
