[wiki] [sites] [dwm][patch][splitstatus] Patch added || Alex Cole

From: <git_AT_suckless.org>
Date: Sat, 14 Nov 2020 09:27:09 +0100

commit f570aaecacb814775a4c5e0378bf6d3619805b5e
Author: Alex Cole <ajzcole_AT_airmail.cc>
Date: Sat Nov 14 21:26:35 2020 +1300

    [dwm][patch][splitstatus] Patch added

diff --git a/dwm.suckless.org/patches/splitstatus/dwm-splitstatus-20201114-61bb8b2.diff b/dwm.suckless.org/patches/splitstatus/dwm-splitstatus-20201114-61bb8b2.diff
new file mode 100644
index 00000000..0f1130c8
--- /dev/null
+++ b/dwm.suckless.org/patches/splitstatus/dwm-splitstatus-20201114-61bb8b2.diff
_AT_@ -0,0 +1,77 @@
+From d2efb5e19eb466f77f0860f0175b84247799bb93 Mon Sep 17 00:00:00 2001
+From: Alex Cole <ajzcole_AT_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
+_AT_@ -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
+_AT_@ -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;
+_AT_@ -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
+
diff --git a/dwm.suckless.org/patches/splitstatus/index.md b/dwm.suckless.org/patches/splitstatus/index.md
new file mode 100644
index 00000000..85605282
--- /dev/null
+++ b/dwm.suckless.org/patches/splitstatus/index.md
_AT_@ -0,0 +1,32 @@
+splitstatus
+==========
+
+Description
+-----------
+Inspired by a reddit post I saw, from someone who had already implemented this behaviour.
+Code for this patch is based on their git repo.
+Unfortunately, I cannot find the reddit post I saw in the first place (it was from quite a while ago).
+
+This patch replaces the standard statusbar items (window name to the right of the tags, and status on the right) with two status items: one in the centre, and one on the right.
+
+The status is still set in the same way with `xsetroot`. However, for the splitstatus behaviour, a delimeter character is added (semicolon by default) to separate the centre status text from the right status text.
+
+Usage
+-----
+Status should be set in the form `<middle>;<right>` if semicolon is the delimeter character (set using the `splitdelim` variable in `config.def.h`).
+
+If the status text does not contain the delimeter character, the text will appear only in the centre of the bar.
+This can be changed by setting the option `splitstatus` to 0, which will put the status text on the right.
+
+Please note that this patch needs `rm config.h` to be added to the `Makefile`.
+
+Screenshots:
+![splitstatus screenshot](splitstatus.png)
+
+Download
+--------
+* [dwm-splitstatus-20201114-61bb8b2.diff](dwm-splitstatus-20201114-61bb8b2.diff)
+
+Author
+------
+* Alex Cole <ajzcole at airmail.cc>
diff --git a/dwm.suckless.org/patches/splitstatus/splitstatus.png b/dwm.suckless.org/patches/splitstatus/splitstatus.png
new file mode 100644
index 00000000..43c3c1f2
Binary files /dev/null and b/dwm.suckless.org/patches/splitstatus/splitstatus.png differ
Received on Sat Nov 14 2020 - 09:27:09 CET

This archive was generated by hypermail 2.3.0 : Sat Nov 14 2020 - 09:36:43 CET