-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy path06-dwm-6.0-monocle_count.diff
42 lines (38 loc) · 1.16 KB
/
06-dwm-6.0-monocle_count.diff
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
42
Homepage: http://hg.punctweb.ro
--- a/dwm.c 2013-02-11 22:11:39.194773229 +0200
+++ b/dwm.c 2013-02-11 22:11:39.196773229 +0200
@@ -754,6 +754,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) {
@@ -770,6 +771,14 @@ drawbar(Monitor *m) {
occ & 1 << i, urg & 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.norm, False);
dc.x += dc.w;
@@ -1230,14 +1239,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);
}