Introduction
Introduction Statistics Contact Development Disclaimer Help
dwm-splitstatus-20201114-61bb8b2.diff - sites - public wiki contents of suckles…
git clone git://git.suckless.org/sites
Log
Files
Refs
---
dwm-splitstatus-20201114-61bb8b2.diff (2783B)
---
1 From d2efb5e19eb466f77f0860f0175b84247799bb93 Mon Sep 17 00:00:00 2001
2 From: Alex Cole <[email protected]>
3 Date: Sat, 14 Nov 2020 21:03:09 +1300
4 Subject: [PATCH] splitstatus patch
5
6 ---
7 config.def.h | 2 ++
8 dwm.c | 31 +++++++++++++++----------------
9 2 files changed, 17 insertions(+), 16 deletions(-)
10
11 diff --git a/config.def.h b/config.def.h
12 index 1c0b587..4161652 100644
13 --- a/config.def.h
14 +++ b/config.def.h
15 @@ -5,6 +5,8 @@ static const unsigned int borderpx = 1; /* borde…
16 static const unsigned int snap = 32; /* snap pixel */
17 static const int showbar = 1; /* 0 means no bar */
18 static const int topbar = 1; /* 0 means bottom bar */
19 +static const int splitstatus = 1; /* 1 for split status i…
20 +static const char *splitdelim = ";"; /* Character used for…
21 static const char *fonts[] = { "monospace:size=10" };
22 static const char dmenufont[] = "monospace:size=10";
23 static const char col_gray1[] = "#222222";
24 diff --git a/dwm.c b/dwm.c
25 index 664c527..e1a8085 100644
26 --- a/dwm.c
27 +++ b/dwm.c
28 @@ -701,13 +701,9 @@ drawbar(Monitor *m)
29 int boxw = drw->fonts->h / 6 + 2;
30 unsigned int i, occ = 0, urg = 0;
31 Client *c;
32 -
33 - /* draw status first so it can be overdrawn by tags later */
34 - if (m == selmon) { /* status is only drawn on selected monitor …
35 - drw_setscheme(drw, scheme[SchemeNorm]);
36 - tw = TEXTW(stext) - lrpad + 2; /* 2px right padding */
37 - drw_text(drw, m->ww - tw, 0, tw, bh, 0, stext, 0);
38 - }
39 + char *mstext;
40 + char *rstext;
41 + int msx;
42
43 for (c = m->clients; c; c = c->next) {
44 occ |= c->tags;
45 @@ -729,17 +725,20 @@ drawbar(Monitor *m)
46 drw_setscheme(drw, scheme[SchemeNorm]);
47 x = drw_text(drw, x, 0, w, bh, lrpad / 2, m->ltsymbol, 0);
48
49 - if ((w = m->ww - tw - x) > bh) {
50 - if (m->sel) {
51 - drw_setscheme(drw, scheme[m == selmon ? SchemeS…
52 - drw_text(drw, x, 0, w, bh, lrpad / 2, m->sel->n…
53 - if (m->sel->isfloating)
54 - drw_rect(drw, x + boxs, boxs, boxw, box…
55 - } else {
56 - drw_setscheme(drw, scheme[SchemeNorm]);
57 - drw_rect(drw, x, 0, w, bh, 1, 1);
58 + drw_setscheme(drw, scheme[SchemeNorm]);
59 + drw_rect(drw, x, 0, m->ww - x, bh, 1, 1);
60 +
61 + if (m == selmon) { /* status is only drawn on selected monitor …
62 + rstext = strdup(stext);
63 + if (splitstatus) {
64 + mstext = strsep(&rstext, splitdelim);
65 + msx = (m->ww - TEXTW(mstext) + lrpad) / 2; /* x…
66 + drw_text(drw, msx, 0, TEXTW(mstext) - lrpad, bh…
67 }
68 + tw = TEXTW(rstext) - lrpad + 2; /* 2px right padding */
69 + drw_text(drw, m->ww - tw, 0, tw, bh, 0, rstext, 0);
70 }
71 +
72 drw_map(drw, m->barwin, 0, 0, m->ww, bh);
73 }
74
75 --
76 2.29.2
77
You are viewing proxied material from suckless.org. The copyright of proxied material belongs to its original authors. Any comments or complaints in relation to proxied material should be directed to the original authors of the content concerned. Please see the disclaimer for more details.