This repository has been archived by the owner on Jan 5, 2018. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 10
/
dwm-6.0-hideempty.diff
78 lines (75 loc) · 2.38 KB
/
dwm-6.0-hideempty.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
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
--- dwm.c.orig 2013-06-01 18:40:49.081863086 +0200
+++ dwm.c 2013-06-01 18:42:16.821861064 +0200
@@ -199,7 +199,6 @@ static void die(const char *errstr, ...)
static Monitor *dirtomon(int dir);
static void drawbar(Monitor *m);
static void drawbars(void);
-static void drawsquare(Bool filled, Bool empty, Bool invert, XftColor col[ColLast]);
static void drawtext(const char *text, XftColor col[ColLast], Bool invert);
static void enternotify(XEvent *e);
static void expose(XEvent *e);
@@ -472,7 +471,7 @@ bstack(Monitor *m) {
void
buttonpress(XEvent *e) {
- unsigned int i, x, click;
+ unsigned int i, x, click, occ = 0;
Arg arg = {0};
Client *c;
Monitor *m;
@@ -486,10 +485,14 @@ buttonpress(XEvent *e) {
focus(NULL);
}
if(ev->window == selmon->barwin) {
+ for(c = m->clients; c; c = c->next)
+ occ |= c->tags;
i = x = 0;
- do
+ do {
+ if (!(m->tagset[m->seltags] & 1 << i) && !(occ & 1 << i))
+ continue;
x += TEXTW(tags[i].name);
- while(ev->x >= x && ++i < LENGTH(tags));
+ } while(ev->x >= x && ++i < LENGTH(tags));
if(i < LENGTH(tags)) {
click = ClkTagBar;
arg.ui = 1 << i;
@@ -789,11 +792,11 @@ drawbar(Monitor *m) {
}
dc.x = 0;
for(i = 0; i < LENGTH(tags); i++) {
+ if (!(m->tagset[m->seltags] & 1 << i) && !(occ & 1 << i))
+ continue;
dc.w = TEXTW(tags[i].name);
col = urg & 1 << i ? dc.urg : m->tagset[m->seltags] & 1 << i ? dc.sel : dc.norm;
drawtext(tags[i].name, col, urg & 1 << i);
- drawsquare(m == selmon && selmon->sel && selmon->sel->tags & 1 << i,
- occ & 1 << i, urg & 1 << i, col);
dc.x += dc.w;
}
dc.w = blw = TEXTW(m->ltsymbol);
@@ -816,7 +819,6 @@ drawbar(Monitor *m) {
if(m->sel) {
col = m == selmon ? dc.sel : dc.norm;
drawtext(m->sel->name, col, False);
- drawsquare(m->sel->isfixed, m->sel->isfloating, False, col);
}
else
drawtext(NULL, dc.norm, False);
@@ -834,18 +836,6 @@ drawbars(void) {
}
void
-drawsquare(Bool filled, Bool empty, Bool invert, XftColor col[ColLast]) {
- int x;
-
- XSetForeground(dpy, dc.gc, col[invert ? ColBG : ColFG].pixel);
- x = (dc.font.ascent + dc.font.descent + 2) / 4;
- if(filled)
- XFillRectangle(dpy, dc.drawable, dc.gc, dc.x+1, dc.y+1, x+1, x+1);
- else if(empty)
- XDrawRectangle(dpy, dc.drawable, dc.gc, dc.x+1, dc.y+1, x, x);
-}
-
-void
drawtext(const char *text, XftColor col[ColLast], Bool invert) {
char buf[256];
int i, x, y, h, len, olen;