dwm/patches/dwm-staticstatus-20211010-a786211.diff

84 lines
2.4 KiB
Diff
Raw Normal View History

2023-02-18 22:55:24 +00:00
diff --git a/config.def.h b/config.def.h
index a2ac963..e485712 100644
--- a/config.def.h
+++ b/config.def.h
@@ -18,6 +18,9 @@ static const char *colors[][3] = {
[SchemeSel] = { col_gray4, col_cyan, col_cyan },
};
+/* staticstatus */
+static const int statmonval = 0;
+
/* tagging */
static const char *tags[] = { "1", "2", "3", "4", "5", "6", "7", "8", "9" };
diff --git a/dwm.c b/dwm.c
index 5e4d494..e5fa599 100644
--- a/dwm.c
+++ b/dwm.c
@@ -266,7 +266,7 @@ static Cur *cursor[CurLast];
static Clr **scheme;
static Display *dpy;
static Drw *drw;
-static Monitor *mons, *selmon;
+static Monitor *mons, *selmon, *statmon;
static Window root, wmcheckwin;
/* configuration, allows nested code to access above variables */
@@ -440,7 +440,7 @@ buttonpress(XEvent *e)
arg.ui = 1 << i;
} else if (ev->x < x + blw)
click = ClkLtSymbol;
- else if (ev->x > selmon->ww - (int)TEXTW(stext))
+ else if (m == statmon && ev->x > selmon->ww - (int)TEXTW(stext))
click = ClkStatusText;
else
click = ClkWinTitle;
@@ -703,7 +703,7 @@ drawbar(Monitor *m)
Client *c;
/* draw status first so it can be overdrawn by tags later */
- if (m == selmon) { /* status is only drawn on selected monitor */
+ if (m == statmon) { /* status is only drawn on user-defined status 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);
@@ -1879,7 +1879,7 @@ updategeom(void)
else
mons = createmon();
}
- for (i = 0, m = mons; i < nn && m; m = m->next, i++)
+ for (i = 0, m = mons; i < nn && m; m = m->next, i++){
if (i >= n
|| unique[i].x_org != m->mx || unique[i].y_org != m->my
|| unique[i].width != m->mw || unique[i].height != m->mh)
@@ -1892,6 +1892,10 @@ updategeom(void)
m->mh = m->wh = unique[i].height;
updatebarpos(m);
}
+ if(i == statmonval)
+ statmon = m;
+ }
+
} else { /* less monitors available nn < n */
for (i = nn; i < n; i++) {
for (m = mons; m && m->next; m = m->next);
@@ -1905,6 +1909,8 @@ updategeom(void)
}
if (m == selmon)
selmon = mons;
+ if (m == statmon)
+ statmon = mons;
cleanupmon(m);
}
}
@@ -1992,7 +1998,7 @@ updatestatus(void)
{
if (!gettextprop(root, XA_WM_NAME, stext, sizeof(stext)))
strcpy(stext, "dwm-"VERSION);
- drawbar(selmon);
+ drawbar(statmon);
}
void