statusbar on all monitors

This commit is contained in:
Jakub 2024-05-10 21:40:10 -04:00
parent ff2e9e5cff
commit 427bb35753

8
dwm.c
View File

@ -766,11 +766,9 @@ drawbar(Monitor *m)
return; return;
/* draw status first so it can be overdrawn by tags later */ /* 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]); drw_setscheme(drw, scheme[SchemeNorm]);
tw = TEXTW(stext) - lrpad + 2; /* 2px right padding */ tw = TEXTW(stext) - lrpad + 2; /* 2px right padding */
drw_text(drw, m->ww - tw, 0, tw, bh, 0, stext, 0); drw_text(drw, m->ww - tw, 0, tw, bh, 0, stext, 0);
}
for (c = m->clients; c; c = c->next) { for (c = m->clients; c; c = c->next) {
occ |= c->tags; occ |= c->tags;
@ -805,7 +803,6 @@ drawbar(Monitor *m)
} }
drw_map(drw, m->barwin, 0, 0, m->ww, bh); drw_map(drw, m->barwin, 0, 0, m->ww, bh);
if (m == selmon) { /* extra status is only drawn on selected monitor */
drw_setscheme(drw, scheme[SchemeNorm]); drw_setscheme(drw, scheme[SchemeNorm]);
/* clear default bar draw buffer by drawing a blank rectangle */ /* clear default bar draw buffer by drawing a blank rectangle */
drw_rect(drw, 0, 0, m->ww, bh, 1, 1); drw_rect(drw, 0, 0, m->ww, bh, 1, 1);
@ -815,7 +812,6 @@ drawbar(Monitor *m)
drw_text(drw, 0, 0, etwl, bh, 0, estextl, 0); drw_text(drw, 0, 0, etwl, bh, 0, estextl, 0);
drw_map(drw, m->extrabarwin, 0, 0, m->ww, bh); drw_map(drw, m->extrabarwin, 0, 0, m->ww, bh);
} }
}
void void
drawbars(void) drawbars(void)
@ -2221,6 +2217,7 @@ updatesizehints(Client *c)
void void
updatestatus(void) updatestatus(void)
{ {
Monitor* m;
char text[768]; char text[768];
if (!gettextprop(root, XA_WM_NAME, text, sizeof(text))) { if (!gettextprop(root, XA_WM_NAME, text, sizeof(text))) {
strcpy(stext, "dwm-"VERSION); strcpy(stext, "dwm-"VERSION);
@ -2241,7 +2238,8 @@ updatestatus(void)
estextr[0] = '\0'; estextr[0] = '\0';
strncpy(stext, text, sizeof(stext) - 1); strncpy(stext, text, sizeof(stext) - 1);
} }
drawbar(selmon); for(m = mons; m; m = m->next)
drawbar(m);
} }
void void