sites

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

commit f570aaecacb814775a4c5e0378bf6d3619805b5e
parent da0cf284e251ba56231e1f6a32c11cab365cc142
Author: Alex Cole <ajzcole@airmail.cc>
Date:   Sat, 14 Nov 2020 21:26:35 +1300

[dwm][patch][splitstatus] Patch added

Diffstat:
Adwm.suckless.org/patches/splitstatus/dwm-splitstatus-20201114-61bb8b2.diff | 77+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
Adwm.suckless.org/patches/splitstatus/index.md | 32++++++++++++++++++++++++++++++++
Adwm.suckless.org/patches/splitstatus/splitstatus.png | 0
3 files changed, 109 insertions(+), 0 deletions(-)

diff --git a/dwm.suckless.org/patches/splitstatus/dwm-splitstatus-20201114-61bb8b2.diff b/dwm.suckless.org/patches/splitstatus/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 + diff --git a/dwm.suckless.org/patches/splitstatus/index.md b/dwm.suckless.org/patches/splitstatus/index.md @@ -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 Binary files differ.