Skip to content

Commit fd6f11f

Browse files
committed
feat: applay split status patch
1 parent ded6cc0 commit fd6f11f

File tree

2 files changed

+21
-12
lines changed

2 files changed

+21
-12
lines changed

src/archy_dwm.c

Lines changed: 16 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -641,12 +641,9 @@ void drawbar(Monitor *m) {
641641
if (showsystray && m == systraytomon(m) && !systrayonleft)
642642
stw = getsystraywidth();
643643

644-
/* draw status first so it can be overdrawn by tags later */
645-
if (m == selmon) { /* status is only drawn on selected monitor */
646-
drw_setscheme(drw, scheme[SchemeNorm]);
647-
tw = TEXTW(stext) - lrpad / 2 + 2; /* 2px extra right padding */
648-
drw_text(drw, m->ww - tw - stw, 0, tw, bh, lrpad / 2 - 2, stext, 0);
649-
}
644+
char *mstext;
645+
char *rstext;
646+
int msx;
650647

651648
resizebarwin(m);
652649
for (c = m->clients; c; c = c->next) {
@@ -670,9 +667,19 @@ void drawbar(Monitor *m) {
670667
drw_setscheme(drw, scheme[SchemeNorm]);
671668
x = drw_text(drw, x, 0, w, bh, lrpad / 2, m->ltsymbol, 0);
672669

673-
if ((w = m->ww - tw - stw - x) > bh) {
674-
drw_setscheme(drw, scheme[SchemeNorm]);
675-
drw_rect(drw, x, 0, w, bh, 1, 1);
670+
drw_setscheme(drw, scheme[SchemeNorm]);
671+
drw_rect(drw, x, 0, m->ww - x, bh, 1, 1);
672+
673+
if (m == selmon) { /* status is only drawn on selected monitor */
674+
rstext = strdup(stext);
675+
if (splitstatus) {
676+
mstext = strsep(&rstext, splitdelim);
677+
msx = (m->ww - TEXTW(mstext) + lrpad) /
678+
2; /* x position of middle status text */
679+
drw_text(drw, msx, 0, TEXTW(mstext) - lrpad, bh, 0, mstext, 0);
680+
}
681+
tw = TEXTW(rstext) - lrpad + 2; /* 2px right padding */
682+
drw_text(drw, m->ww - tw, 0, tw, bh, 0, rstext, 0);
676683
}
677684
drw_map(drw, m->barwin, 0, 0, m->ww - stw, bh);
678685
}

src/config/config.h

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -25,9 +25,11 @@ static const unsigned int systrayspacing = 2; /* systray spacing */
2525
static const int systraypinningfailfirst =
2626
1; /* 1: if pinning fails, display systray on the first monitor, False:
2727
display systray on the last monitor*/
28-
static const int showsystray = 1; /* 0 means no systray */
29-
static const int showbar = 1; /* 0 means no bar */
30-
static const int topbar = 0; /* 0 means bottom bar */
28+
static const int showsystray = 1; /* 0 means no systray */
29+
static const int showbar = 1; /* 0 means no bar */
30+
static const int topbar = 0; /* 0 means bottom bar */
31+
static const int splitstatus = 1; /* 1 for split status items */
32+
static const char *splitdelim = ";"; /* Character used for separating status */
3133
static const char *fonts[] = {
3234
"monospace:size=6", "Noto Color Emoji:size=7",
3335
"Nerd Font Mono:size=10:antialias=true:hinting=true"};

0 commit comments

Comments
 (0)