aewl
diff bar.c @ 16:359b6e563b95
several changes, new stuff
author | Anselm R. Garbe <garbeam@wmii.de> |
---|---|
date | Tue, 11 Jul 2006 18:53:41 +0200 |
parents | 5c078b66347b |
children | bd3a44353916 |
line diff
1.1 --- a/bar.c Tue Jul 11 18:19:01 2006 +0200 1.2 +++ b/bar.c Tue Jul 11 18:53:41 2006 +0200 1.3 @@ -5,22 +5,24 @@ 1.4 1.5 #include "wm.h" 1.6 1.7 -static const char *status[] = { 1.8 - "sh", "-c", "echo -n `date` `uptime | sed 's/.*://; s/,//g'`" 1.9 - " `acpi | awk '{print $4}' | sed 's/,//'`", 0 \ 1.10 -}; 1.11 - 1.12 void 1.13 draw_bar() 1.14 { 1.15 - static char buf[1024]; 1.16 - 1.17 - buf[0] = 0; 1.18 - pipe_spawn(buf, sizeof(buf), dpy, (char **)status); 1.19 - 1.20 brush.rect = barrect; 1.21 brush.rect.x = brush.rect.y = 0; 1.22 - draw(dpy, &brush, False, buf); 1.23 + draw(dpy, &brush, False, NULL); 1.24 + 1.25 + if(stack) { 1.26 + brush.rect.width = textwidth(&brush.font, stack->name) + labelheight(&brush.font); 1.27 + swap((void **)&brush.fg, (void **)&brush.bg); 1.28 + draw(dpy, &brush, False, stack->name); 1.29 + swap((void **)&brush.fg, (void **)&brush.bg); 1.30 + brush.rect.x += brush.rect.width; 1.31 + } 1.32 + 1.33 + brush.rect.width = textwidth(&brush.font, statustext) + labelheight(&brush.font); 1.34 + brush.rect.x = barrect.x + barrect.width - brush.rect.width; 1.35 + draw(dpy, &brush, False, statustext); 1.36 1.37 XCopyArea(dpy, brush.drawable, barwin, brush.gc, 0, 0, barrect.width, 1.38 barrect.height, 0, 0);