staticstatus + extrabar: Allow extrabar to be static on a monitor other than that of the main staticstatus monitor

This commit is contained in:
bakkeby 2020-07-08 14:13:29 +02:00
parent ccb275b984
commit fbaa215a14
2 changed files with 25 additions and 3 deletions

View File

@ -57,6 +57,9 @@ static const int quit_empty_window_count = 2; /* only allow dwm to quit if no
#if EXTRABAR_PATCH
static const char statussep = ';'; /* separator between status bars */
static const int ebalign = 0; /* extrabar alignment: 0 - left, 1 - right, 2 - center */
#if STATICSTATUS_PATCH && !STATUSALLMONS_PATCH
static const int statebmonval = statmonval;
#endif // STATICSTATUS_PATCH
#endif // EXTRABAR_PATCH
#if PANGO_PATCH
static const char font[] = "monospace 10";

25
dwm.c
View File

@ -593,6 +593,9 @@ static Drw *drw;
static Monitor *mons, *selmon;
#if STATICSTATUS_PATCH && !STATUSALLMONS_PATCH
static Monitor *statmon;
#if EXTRABAR_PATCH
static Monitor *statebmon;
#endif // EXTRABAR_PATCH
#endif // STATICSTATUS_PATCH
static Window root, wmcheckwin;
@ -1993,7 +1996,7 @@ drawbar(Monitor *m)
#if EXTRABAR_PATCH
#if STATICSTATUS_PATCH
if (m == statmon && m->extrabarwin)
if (m == statebmon && m->extrabarwin)
#else
if (m == selmon && m->extrabarwin)
#endif // STATICSTATUS_PATCH
@ -4019,7 +4022,7 @@ updatebars(void)
}
#if EXTRABAR_PATCH
#if STATICSTATUS_PATCH
if (m == statmon && !m->extrabarwin)
if (m == statebmon && !m->extrabarwin)
#else
if (!m->extrabarwin)
#endif // STATICSTATUS_PATCH
@ -4060,7 +4063,7 @@ updatebarpos(Monitor *m)
#if EXTRABAR_PATCH
int num_bars;
#if STATICSTATUS_PATCH
int has_extrabar = (m == statmon);
int has_extrabar = (m == statebmon);
#else
int has_extrabar = 1;
#endif // STATICSTATUS_PATCH
@ -4157,6 +4160,10 @@ updategeom(void)
#if STATICSTATUS_PATCH && !STATUSALLMONS_PATCH
if (i == statmonval)
statmon = m;
#if EXTRABAR_PATCH
if (i == statebmonval)
statebmon = m;
#endif // EXTRABAR_PATCH
#endif // STATICSTATUS_PATCH
if (i >= n
|| unique[i].x_org != m->mx || unique[i].y_org != m->my
@ -4187,6 +4194,10 @@ updategeom(void)
#if STATICSTATUS_PATCH && !STATUSALLMONS_PATCH
if (m == statmon)
statmon = mons;
#if EXTRABAR_PATCH
if (m == statebmon)
statebmon = mons;
#endif // EXTRABAR_PATCH
#endif // STATICSTATUS_PATCH
cleanupmon(m);
}
@ -4207,6 +4218,10 @@ updategeom(void)
#if STATICSTATUS_PATCH && !STATUSALLMONS_PATCH
if (!statmon)
statmon = mons;
#if EXTRABAR_PATCH
if (!statebmon)
statebmon = mons;
#endif // EXTRABAR_PATCH
#endif // STATICSTATUS_PATCH
if (dirty) {
selmon = mons;
@ -4331,6 +4346,10 @@ updatestatus(void)
drawbar(m);
#elif STATICSTATUS_PATCH
drawbar(statmon);
#if EXTRABAR_PATCH
if (statmon != statebmon)
drawbar(statebmon);
#endif // EXTRABAR_PATCH
#else
drawbar(selmon);
#endif // STATUSALLMONS_PATCH | STATICSTATUS_PATCH