author | Anselm R. Garbe <garbeam@wmii.de> |
Fri, 14 Jul 2006 18:55:50 +0200 | |
changeset 71 | 7681ef838201 |
parent 66 | 50450aa24a46 |
child 72 | d0eb0bb63c40 |
permissions | -rw-r--r-- |
57
f005d46462e8
implemented bar for dwm (I miss status text), I plan that status text is read from stdin in dwm
Anselm R. Garbe <garbeam@wmii.de>
parents:
diff
changeset
|
1 |
/* |
f005d46462e8
implemented bar for dwm (I miss status text), I plan that status text is read from stdin in dwm
Anselm R. Garbe <garbeam@wmii.de>
parents:
diff
changeset
|
2 |
* (C)opyright MMVI Anselm R. Garbe <garbeam at gmail dot com> |
f005d46462e8
implemented bar for dwm (I miss status text), I plan that status text is read from stdin in dwm
Anselm R. Garbe <garbeam@wmii.de>
parents:
diff
changeset
|
3 |
* See LICENSE file for license details. |
f005d46462e8
implemented bar for dwm (I miss status text), I plan that status text is read from stdin in dwm
Anselm R. Garbe <garbeam@wmii.de>
parents:
diff
changeset
|
4 |
*/ |
f005d46462e8
implemented bar for dwm (I miss status text), I plan that status text is read from stdin in dwm
Anselm R. Garbe <garbeam@wmii.de>
parents:
diff
changeset
|
5 |
|
f005d46462e8
implemented bar for dwm (I miss status text), I plan that status text is read from stdin in dwm
Anselm R. Garbe <garbeam@wmii.de>
parents:
diff
changeset
|
6 |
#include "dwm.h" |
f005d46462e8
implemented bar for dwm (I miss status text), I plan that status text is read from stdin in dwm
Anselm R. Garbe <garbeam@wmii.de>
parents:
diff
changeset
|
7 |
|
f005d46462e8
implemented bar for dwm (I miss status text), I plan that status text is read from stdin in dwm
Anselm R. Garbe <garbeam@wmii.de>
parents:
diff
changeset
|
8 |
void |
58
1269bd127551
made barclick to select the specific tag
Anselm R. Garbe <garbeam@wmii.de>
parents:
57
diff
changeset
|
9 |
barclick(XButtonPressedEvent *e) |
1269bd127551
made barclick to select the specific tag
Anselm R. Garbe <garbeam@wmii.de>
parents:
57
diff
changeset
|
10 |
{ |
1269bd127551
made barclick to select the specific tag
Anselm R. Garbe <garbeam@wmii.de>
parents:
57
diff
changeset
|
11 |
int x = 0; |
1269bd127551
made barclick to select the specific tag
Anselm R. Garbe <garbeam@wmii.de>
parents:
57
diff
changeset
|
12 |
Arg a; |
1269bd127551
made barclick to select the specific tag
Anselm R. Garbe <garbeam@wmii.de>
parents:
57
diff
changeset
|
13 |
for(a.i = 0; a.i < TLast; a.i++) { |
1269bd127551
made barclick to select the specific tag
Anselm R. Garbe <garbeam@wmii.de>
parents:
57
diff
changeset
|
14 |
x += textw(tags[a.i]) + dc.font.height; |
1269bd127551
made barclick to select the specific tag
Anselm R. Garbe <garbeam@wmii.de>
parents:
57
diff
changeset
|
15 |
if(e->x < x) { |
1269bd127551
made barclick to select the specific tag
Anselm R. Garbe <garbeam@wmii.de>
parents:
57
diff
changeset
|
16 |
view(&a); |
1269bd127551
made barclick to select the specific tag
Anselm R. Garbe <garbeam@wmii.de>
parents:
57
diff
changeset
|
17 |
return; |
1269bd127551
made barclick to select the specific tag
Anselm R. Garbe <garbeam@wmii.de>
parents:
57
diff
changeset
|
18 |
} |
1269bd127551
made barclick to select the specific tag
Anselm R. Garbe <garbeam@wmii.de>
parents:
57
diff
changeset
|
19 |
} |
1269bd127551
made barclick to select the specific tag
Anselm R. Garbe <garbeam@wmii.de>
parents:
57
diff
changeset
|
20 |
} |
1269bd127551
made barclick to select the specific tag
Anselm R. Garbe <garbeam@wmii.de>
parents:
57
diff
changeset
|
21 |
|
1269bd127551
made barclick to select the specific tag
Anselm R. Garbe <garbeam@wmii.de>
parents:
57
diff
changeset
|
22 |
void |
57
f005d46462e8
implemented bar for dwm (I miss status text), I plan that status text is read from stdin in dwm
Anselm R. Garbe <garbeam@wmii.de>
parents:
diff
changeset
|
23 |
draw_bar() |
f005d46462e8
implemented bar for dwm (I miss status text), I plan that status text is read from stdin in dwm
Anselm R. Garbe <garbeam@wmii.de>
parents:
diff
changeset
|
24 |
{ |
f005d46462e8
implemented bar for dwm (I miss status text), I plan that status text is read from stdin in dwm
Anselm R. Garbe <garbeam@wmii.de>
parents:
diff
changeset
|
25 |
int i; |
71
7681ef838201
bar shows if currently is tiled (Mod1-space) or floating (Mod1-Shift-space) mode
Anselm R. Garbe <garbeam@wmii.de>
parents:
66
diff
changeset
|
26 |
char *mode = arrange == tiling ? "#" : "~"; |
7681ef838201
bar shows if currently is tiled (Mod1-space) or floating (Mod1-Shift-space) mode
Anselm R. Garbe <garbeam@wmii.de>
parents:
66
diff
changeset
|
27 |
|
57
f005d46462e8
implemented bar for dwm (I miss status text), I plan that status text is read from stdin in dwm
Anselm R. Garbe <garbeam@wmii.de>
parents:
diff
changeset
|
28 |
dc.x = dc.y = 0; |
f005d46462e8
implemented bar for dwm (I miss status text), I plan that status text is read from stdin in dwm
Anselm R. Garbe <garbeam@wmii.de>
parents:
diff
changeset
|
29 |
dc.w = bw; |
66
50450aa24a46
removed a bunch of lines through swap removal
Anselm R. Garbe <garbeam@wmii.de>
parents:
58
diff
changeset
|
30 |
drawtext(NULL, False, False); |
57
f005d46462e8
implemented bar for dwm (I miss status text), I plan that status text is read from stdin in dwm
Anselm R. Garbe <garbeam@wmii.de>
parents:
diff
changeset
|
31 |
|
71
7681ef838201
bar shows if currently is tiled (Mod1-space) or floating (Mod1-Shift-space) mode
Anselm R. Garbe <garbeam@wmii.de>
parents:
66
diff
changeset
|
32 |
dc.w = textw(mode) + dc.font.height; |
7681ef838201
bar shows if currently is tiled (Mod1-space) or floating (Mod1-Shift-space) mode
Anselm R. Garbe <garbeam@wmii.de>
parents:
66
diff
changeset
|
33 |
drawtext(mode, True, True); |
7681ef838201
bar shows if currently is tiled (Mod1-space) or floating (Mod1-Shift-space) mode
Anselm R. Garbe <garbeam@wmii.de>
parents:
66
diff
changeset
|
34 |
|
57
f005d46462e8
implemented bar for dwm (I miss status text), I plan that status text is read from stdin in dwm
Anselm R. Garbe <garbeam@wmii.de>
parents:
diff
changeset
|
35 |
for(i = 0; i < TLast; i++) { |
f005d46462e8
implemented bar for dwm (I miss status text), I plan that status text is read from stdin in dwm
Anselm R. Garbe <garbeam@wmii.de>
parents:
diff
changeset
|
36 |
dc.x += dc.w; |
f005d46462e8
implemented bar for dwm (I miss status text), I plan that status text is read from stdin in dwm
Anselm R. Garbe <garbeam@wmii.de>
parents:
diff
changeset
|
37 |
dc.w = textw(tags[i]) + dc.font.height; |
66
50450aa24a46
removed a bunch of lines through swap removal
Anselm R. Garbe <garbeam@wmii.de>
parents:
58
diff
changeset
|
38 |
drawtext(tags[i], i == tsel, True); |
57
f005d46462e8
implemented bar for dwm (I miss status text), I plan that status text is read from stdin in dwm
Anselm R. Garbe <garbeam@wmii.de>
parents:
diff
changeset
|
39 |
} |
f005d46462e8
implemented bar for dwm (I miss status text), I plan that status text is read from stdin in dwm
Anselm R. Garbe <garbeam@wmii.de>
parents:
diff
changeset
|
40 |
if(sel) { |
f005d46462e8
implemented bar for dwm (I miss status text), I plan that status text is read from stdin in dwm
Anselm R. Garbe <garbeam@wmii.de>
parents:
diff
changeset
|
41 |
dc.x += dc.w; |
f005d46462e8
implemented bar for dwm (I miss status text), I plan that status text is read from stdin in dwm
Anselm R. Garbe <garbeam@wmii.de>
parents:
diff
changeset
|
42 |
dc.w = textw(sel->name) + dc.font.height; |
66
50450aa24a46
removed a bunch of lines through swap removal
Anselm R. Garbe <garbeam@wmii.de>
parents:
58
diff
changeset
|
43 |
drawtext(sel->name, True, True); |
57
f005d46462e8
implemented bar for dwm (I miss status text), I plan that status text is read from stdin in dwm
Anselm R. Garbe <garbeam@wmii.de>
parents:
diff
changeset
|
44 |
} |
f005d46462e8
implemented bar for dwm (I miss status text), I plan that status text is read from stdin in dwm
Anselm R. Garbe <garbeam@wmii.de>
parents:
diff
changeset
|
45 |
dc.w = textw(stext) + dc.font.height; |
f005d46462e8
implemented bar for dwm (I miss status text), I plan that status text is read from stdin in dwm
Anselm R. Garbe <garbeam@wmii.de>
parents:
diff
changeset
|
46 |
dc.x = bx + bw - dc.w; |
66
50450aa24a46
removed a bunch of lines through swap removal
Anselm R. Garbe <garbeam@wmii.de>
parents:
58
diff
changeset
|
47 |
drawtext(stext, False, False); |
57
f005d46462e8
implemented bar for dwm (I miss status text), I plan that status text is read from stdin in dwm
Anselm R. Garbe <garbeam@wmii.de>
parents:
diff
changeset
|
48 |
XCopyArea(dpy, dc.drawable, barwin, dc.gc, 0, 0, bw, bh, 0, 0); |
f005d46462e8
implemented bar for dwm (I miss status text), I plan that status text is read from stdin in dwm
Anselm R. Garbe <garbeam@wmii.de>
parents:
diff
changeset
|
49 |
XFlush(dpy); |
f005d46462e8
implemented bar for dwm (I miss status text), I plan that status text is read from stdin in dwm
Anselm R. Garbe <garbeam@wmii.de>
parents:
diff
changeset
|
50 |
} |