dwm-meillo
view bar.c @ 72:d0eb0bb63c40
I prefer the tiled/floating indicator on the right side
author | Anselm R. Garbe <garbeam@wmii.de> |
---|---|
date | Fri, 14 Jul 2006 18:59:25 +0200 |
parents | 7681ef838201 |
children |
line source
1 /*
2 * (C)opyright MMVI Anselm R. Garbe <garbeam at gmail dot com>
3 * See LICENSE file for license details.
4 */
6 #include "dwm.h"
8 void
9 barclick(XButtonPressedEvent *e)
10 {
11 int x = 0;
12 Arg a;
13 for(a.i = 0; a.i < TLast; a.i++) {
14 x += textw(tags[a.i]) + dc.font.height;
15 if(e->x < x) {
16 view(&a);
17 return;
18 }
19 }
20 }
22 void
23 draw_bar()
24 {
25 int i, modw;
26 char *mode = arrange == tiling ? "#" : "~";
28 dc.x = dc.y = 0;
29 dc.w = bw;
30 drawtext(NULL, False, False);
32 modw = textw(mode) + dc.font.height;
33 dc.w = 0;
34 for(i = 0; i < TLast; i++) {
35 dc.x += dc.w;
36 dc.w = textw(tags[i]) + dc.font.height;
37 drawtext(tags[i], i == tsel, True);
38 }
39 if(sel) {
40 dc.x += dc.w;
41 dc.w = textw(sel->name) + dc.font.height;
42 drawtext(sel->name, True, True);
43 }
44 dc.w = textw(stext) + dc.font.height;
45 dc.x = bx + bw - dc.w - modw;
46 drawtext(stext, False, False);
48 dc.x = bx + bw - modw;
49 dc.w = modw;
50 drawtext(mode, True, True);
52 XCopyArea(dpy, dc.drawable, barwin, dc.gc, 0, 0, bw, bh, 0, 0);
53 XFlush(dpy);
54 }