dwm-staticstatus-6.2.diff - sites - public wiki contents of suckless.org
(HTM) git clone git://git.suckless.org/sites
(DIR) Log
(DIR) Files
(DIR) Refs
---
dwm-staticstatus-6.2.diff (2145B)
---
1 diff --git a/config.def.h b/config.def.h
2 index 1c0b587..ea010c3 100644
3 --- a/config.def.h
4 +++ b/config.def.h
5 @@ -18,6 +18,9 @@ static const char *colors[][3] = {
6 [SchemeSel] = { col_gray4, col_cyan, col_cyan },
7 };
8
9 +/* staticstatus */
10 +static const int statmonval = 0;
11 +
12 /* tagging */
13 static const char *tags[] = { "1", "2", "3", "4", "5", "6", "7", "8", "9" };
14
15 diff --git a/dwm.c b/dwm.c
16 index 9fd0286..d6eb701 100644
17 --- a/dwm.c
18 +++ b/dwm.c
19 @@ -266,7 +266,7 @@ static Cur *cursor[CurLast];
20 static Clr **scheme;
21 static Display *dpy;
22 static Drw *drw;
23 -static Monitor *mons, *selmon;
24 +static Monitor *mons, *selmon, *statmon;
25 static Window root, wmcheckwin;
26
27 /* configuration, allows nested code to access above variables */
28 @@ -703,7 +703,7 @@ drawbar(Monitor *m)
29 Client *c;
30
31 /* draw status first so it can be overdrawn by tags later */
32 - if (m == selmon) { /* status is only drawn on selected monitor */
33 + if (m == statmon) { /* status is only drawn on user-defined status monitor */
34 drw_setscheme(drw, scheme[SchemeNorm]);
35 tw = TEXTW(stext) - lrpad + 2; /* 2px right padding */
36 drw_text(drw, m->ww - tw, 0, tw, bh, 0, stext, 0);
37 @@ -1879,7 +1879,7 @@ updategeom(void)
38 else
39 mons = createmon();
40 }
41 - for (i = 0, m = mons; i < nn && m; m = m->next, i++)
42 + for (i = 0, m = mons; i < nn && m; m = m->next, i++){
43 if (i >= n
44 || unique[i].x_org != m->mx || unique[i].y_org != m->my
45 || unique[i].width != m->mw || unique[i].height != m->mh)
46 @@ -1892,6 +1892,10 @@ updategeom(void)
47 m->mh = m->wh = unique[i].height;
48 updatebarpos(m);
49 }
50 + if(i == statmonval)
51 + statmon = m;
52 + }
53 +
54 } else { /* less monitors available nn < n */
55 for (i = nn; i < n; i++) {
56 for (m = mons; m && m->next; m = m->next);
57 @@ -1905,6 +1909,8 @@ updategeom(void)
58 }
59 if (m == selmon)
60 selmon = mons;
61 + if (m == statmon)
62 + statmon = mons;
63 cleanupmon(m);
64 }
65 }
66 @@ -1992,7 +1998,7 @@ updatestatus(void)
67 {
68 if (!gettextprop(root, XA_WM_NAME, stext, sizeof(stext)))
69 strcpy(stext, "dwm-"VERSION);
70 - drawbar(selmon);
71 + drawbar(statmon);
72 }
73
74 void