aewl

diff 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 diff
     1.1 --- /dev/null	Thu Jan 01 00:00:00 1970 +0000
     1.2 +++ b/bar.c	Fri Jul 14 10:07:38 2006 +0200
     1.3 @@ -0,0 +1,40 @@
     1.4 +/*
     1.5 + * (C)opyright MMVI Anselm R. Garbe <garbeam at gmail dot com>
     1.6 + * See LICENSE file for license details.
     1.7 + */
     1.8 +
     1.9 +#include "dwm.h"
    1.10 +
    1.11 +void
    1.12 +draw_bar()
    1.13 +{
    1.14 +	int i;
    1.15 +	dc.x = dc.y = 0;
    1.16 +	dc.w = bw;
    1.17 +	drawtext(NULL, False);
    1.18 +
    1.19 +	dc.w = 0;
    1.20 +	for(i = 0; i < TLast; i++) {
    1.21 +		dc.x += dc.w;
    1.22 +		dc.w = textw(tags[i]) + dc.font.height;
    1.23 +		if(i == tsel) {
    1.24 +			swap((void **)&dc.fg, (void **)&dc.bg);
    1.25 +			drawtext(tags[i], True);
    1.26 +			swap((void **)&dc.fg, (void **)&dc.bg);
    1.27 +		}
    1.28 +		else
    1.29 +			drawtext(tags[i], True);
    1.30 +	}
    1.31 +	if(sel) {
    1.32 +		swap((void **)&dc.fg, (void **)&dc.bg);
    1.33 +		dc.x += dc.w;
    1.34 +		dc.w = textw(sel->name) + dc.font.height;
    1.35 +		drawtext(sel->name, True);
    1.36 +		swap((void **)&dc.fg, (void **)&dc.bg);
    1.37 +	}
    1.38 +	dc.w = textw(stext) + dc.font.height;
    1.39 +	dc.x = bx + bw - dc.w;
    1.40 +	drawtext(stext, False);
    1.41 +	XCopyArea(dpy, dc.drawable, barwin, dc.gc, 0, 0, bw, bh, 0, 0);
    1.42 +	XFlush(dpy);
    1.43 +}