summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--config.def.h2
-rw-r--r--dwm.c30
2 files changed, 17 insertions, 15 deletions
diff --git a/config.def.h b/config.def.h
index 00656dd..27eedf8 100644
--- a/config.def.h
+++ b/config.def.h
@@ -11,6 +11,8 @@ static const int smartgaps = 0; /* 1 means no outer gap when the
static const int swallowfloating = 0; /* 1 means swallow floating windows by default */
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 6494780..3ceee57 100644
--- a/dwm.c
+++ b/dwm.c
@@ -795,12 +795,9 @@ drawbar(Monitor *m)
if (!m->showbar)
return;
- /* 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;
@@ -822,17 +819,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);
}