aewl

view bar.c @ 57:f005d46462e8

implemented bar for dwm (I miss status text), I plan that status text is read from stdin in dwm
author Anselm R. Garbe <garbeam@wmii.de>
date Fri, 14 Jul 2006 10:07:38 +0200
parents
children 1269bd127551
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 draw_bar()
10 {
11 int i;
12 dc.x = dc.y = 0;
13 dc.w = bw;
14 drawtext(NULL, False);
16 dc.w = 0;
17 for(i = 0; i < TLast; i++) {
18 dc.x += dc.w;
19 dc.w = textw(tags[i]) + dc.font.height;
20 if(i == tsel) {
21 swap((void **)&dc.fg, (void **)&dc.bg);
22 drawtext(tags[i], True);
23 swap((void **)&dc.fg, (void **)&dc.bg);
24 }
25 else
26 drawtext(tags[i], True);
27 }
28 if(sel) {
29 swap((void **)&dc.fg, (void **)&dc.bg);
30 dc.x += dc.w;
31 dc.w = textw(sel->name) + dc.font.height;
32 drawtext(sel->name, True);
33 swap((void **)&dc.fg, (void **)&dc.bg);
34 }
35 dc.w = textw(stext) + dc.font.height;
36 dc.x = bx + bw - dc.w;
37 drawtext(stext, False);
38 XCopyArea(dpy, dc.drawable, barwin, dc.gc, 0, 0, bw, bh, 0, 0);
39 XFlush(dpy);
40 }