-
Notifications
You must be signed in to change notification settings - Fork 9
Expand file tree
/
Copy path02-monoclecount.diff
More file actions
41 lines (38 loc) · 1.15 KB
/
02-monoclecount.diff
File metadata and controls
41 lines (38 loc) · 1.15 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
diff -up a/dwm.c b/dwm.c
--- a/dwm.c 2012-07-17 17:26:42.304013467 +1000
+++ b/dwm.c 2012-07-17 17:27:06.540548834 +1000
@@ -721,6 +721,7 @@ drawbar(Monitor *m) {
int x;
unsigned int i, occ = 0, urg = 0;
unsigned long *col;
+ unsigned int a = 0, s = 0;
Client *c;
for(c = m->clients; c; c = c->next) {
@@ -738,6 +739,14 @@ drawbar(Monitor *m) {
occ & 1 << i, col);
dc.x += dc.w;
}
+ if(m->lt[m->sellt]->arrange == monocle) {
+ for(a = 0, s = 0, c= nexttiled(m->clients); c; c= nexttiled(c->next), a++)
+ if(c == m->stack)
+ s = a;
+ if(!s && a)
+ s = a;
+ snprintf(m->ltsymbol, sizeof m->ltsymbol, "[%d/%d]", s, a);
+ }
dc.w = blw = TEXTW(m->ltsymbol);
drawtext(m->ltsymbol, dc.colors[0], False);
dc.x += dc.w;
@@ -1218,14 +1227,8 @@ maprequest(XEvent *e) {
void
monocle(Monitor *m) {
- unsigned int n = 0;
Client *c;
- for(c = m->clients; c; c = c->next)
- if(ISVISIBLE(c))
- n++;
- if(n > 0) /* override layout symbol */
- snprintf(m->ltsymbol, sizeof m->ltsymbol, "[%d]", n);
for(c = nexttiled(m->clients); c; c = nexttiled(c->next))
resize(c, m->wx, m->wy, m->ww - 2 * c->bw, m->wh - 2 * c->bw, False);
}