static status
This commit is contained in:
parent
1238459791
commit
45680a8a2c
@ -23,6 +23,9 @@ static const char *colors[][3] = {
|
||||
static const XPoint stickyicon[] = { {0,0}, {4,0}, {4,8}, {2,6}, {0,8}, {0,0} }; /* represents the icon as an array of vertices */
|
||||
static const XPoint stickyiconbb = {4,8}; /* defines the bottom right corner of the polygon's bounding box (speeds up scaling) */
|
||||
|
||||
/* staticstatus */
|
||||
static const int statmonval = 0;
|
||||
|
||||
/* tagging */
|
||||
static const char *tags[] = { "1", "2", "3", "4", "5", "6", "7", "8", "9" };
|
||||
|
||||
|
10
config.h
10
config.h
@ -21,6 +21,9 @@ static const char *fonts[] = { "Iosevka:pixelsize=14:antialias=true:aut
|
||||
static const XPoint stickyicon[] = { {0,0}, {4,0}, {4,8}, {2,6}, {0,8}, {0,0} }; /* represents the icon as an array of vertices */
|
||||
static const XPoint stickyiconbb = {4,8}; /* defines the bottom right corner of the polygon's bounding box (speeds up scaling) */
|
||||
|
||||
/* staticstatus */
|
||||
static const int statmonval = 0;
|
||||
|
||||
/* tagging */
|
||||
static const char *tags[] = { "irc", "www", "dev", "doc", "mus", "gme", "trm", "sys", "msc" };
|
||||
|
||||
@ -34,6 +37,13 @@ static const Rule rules[] = {
|
||||
{ "st-256color", "st", "pulsemixer", 0, 1, -1 },
|
||||
};
|
||||
|
||||
/* monitor rules */
|
||||
static const MonitorRule monrules[] = {
|
||||
/* monitor layout mfact nmaster showbar topbar */
|
||||
{ 1, 0, -1, 0, -1, -1 }, // use a different layout for the second monitor
|
||||
{ -1, 0, -1, -1, -1, -1 }, // default
|
||||
};
|
||||
|
||||
/* layout(s) */
|
||||
static const float mfact = 0.5; /* factor of master area size [0.05..0.95] */
|
||||
static const int nmaster = 1; /* number of clients in master area */
|
||||
|
17
dwm.c
17
dwm.c
@ -283,7 +283,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 */
|
||||
@ -477,7 +477,7 @@ buttonpress(XEvent *e)
|
||||
arg.ui = 1 << i;
|
||||
} else if (ev->x < x + TEXTW(selmon->ltsymbol))
|
||||
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;
|
||||
@ -783,7 +783,7 @@ drawbar(Monitor *m)
|
||||
return;
|
||||
|
||||
/* 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);
|
||||
@ -2087,7 +2087,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)
|
||||
@ -2100,6 +2100,9 @@ updategeom(void)
|
||||
m->mh = m->wh = unique[i].height;
|
||||
updatebarpos(m);
|
||||
}
|
||||
if(i == statmonval)
|
||||
statmon = m;
|
||||
}
|
||||
/* removed monitors if n > nn */
|
||||
for (i = nn; i < n; i++) {
|
||||
for (m = mons; m && m->next; m = m->next);
|
||||
@ -2111,8 +2114,8 @@ updategeom(void)
|
||||
attachbottom(c);
|
||||
attachstack(c);
|
||||
}
|
||||
if (m == selmon)
|
||||
selmon = mons;
|
||||
if (m == statmon)
|
||||
statmon = mons;
|
||||
cleanupmon(m);
|
||||
}
|
||||
free(unique);
|
||||
@ -2200,7 +2203,7 @@ updatestatus(void)
|
||||
{
|
||||
if (!gettextprop(root, XA_WM_NAME, stext, sizeof(stext)))
|
||||
strcpy(stext, "dwm-"VERSION);
|
||||
drawbar(selmon);
|
||||
drawbar(statmon);
|
||||
}
|
||||
|
||||
void
|
||||
|
83
patches/dwm-staticstatus-20211010-a786211.diff
Normal file
83
patches/dwm-staticstatus-20211010-a786211.diff
Normal file
@ -0,0 +1,83 @@
|
||||
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
|
Loading…
Reference in New Issue
Block a user