-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathdwm-monoclecount-6.2.diff
52 lines (47 loc) · 1.45 KB
/
dwm-monoclecount-6.2.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
43
44
45
46
47
48
49
50
51
From a8cfc27e5ccdf43ebfb7505cb9cc0aea347d7d9d Mon Sep 17 00:00:00 2001
From: Hilde N <[email protected]>
Date: Sat, 23 May 2020 22:29:52 -0400
Subject: [PATCH] display current index and total number of windows when using
monocle layout
---
dwm.c | 21 ++++++++++++++++++---
1 file changed, 18 insertions(+), 3 deletions(-)
diff --git a/dwm.c b/dwm.c
index 9fd0286..bf89f31 100644
--- a/dwm.c
+++ b/dwm.c
@@ -701,6 +701,8 @@ drawbar(Monitor *m)
int boxw = drw->fonts->h / 6 + 2;
unsigned int i, occ = 0, urg = 0;
Client *c;
+ unsigned int n = 0, s = 0;
+ char posbuf[16];
/* draw status first so it can be overdrawn by tags later */
if (m == selmon) { /* status is only drawn on selected monitor */
@@ -725,9 +727,22 @@ drawbar(Monitor *m)
urg & 1 << i);
x += w;
}
- w = blw = TEXTW(m->ltsymbol);
- drw_setscheme(drw, scheme[SchemeNorm]);
- x = drw_text(drw, x, 0, w, bh, lrpad / 2, m->ltsymbol, 0);
+
+ if (m->lt[m->sellt]->arrange == monocle) {
+ for (c = nexttiled(m->clients); c; c = nexttiled(c->next)) {
+ n++;
+ if (c == m->sel)
+ s = n;
+ }
+ snprintf(posbuf, LENGTH(posbuf), "[%d/%d]", s, n);
+ w = blw = TEXTW(posbuf);
+ drw_setscheme(drw, scheme[SchemeNorm]);
+ x = drw_text(drw, x, 0, w, bh, lrpad / 2, posbuf, 0);
+ } else {
+ w = blw = TEXTW(m->ltsymbol);
+ drw_setscheme(drw, scheme[SchemeNorm]);
+ x = drw_text(drw, x, 0, w, bh, lrpad / 2, m->ltsymbol, 0);
+ }
if ((w = m->ww - tw - x) > bh) {
if (m->sel) {
--
2.26.2