diff options
author | Anselm R. Garbe <garbeam@wmii.de> | 2006-07-11 18:53:41 +0200 |
---|---|---|
committer | Anselm R. Garbe <garbeam@wmii.de> | 2006-07-11 18:53:41 +0200 |
commit | d6e0e6e9879c144f5d374fca0c015fd6208fc27e (patch) | |
tree | 997db1276dc89c44361a56d80a66fb3722f8f2fe /bar.c | |
parent | b1669b5c48f71c9a7a919dbf09a1af527c62f69a (diff) | |
download | dwm-d6e0e6e9879c144f5d374fca0c015fd6208fc27e.tar.gz dwm-d6e0e6e9879c144f5d374fca0c015fd6208fc27e.tar.bz2 dwm-d6e0e6e9879c144f5d374fca0c015fd6208fc27e.zip |
several changes, new stuff
Diffstat (limited to 'bar.c')
-rw-r--r-- | bar.c | 24 |
1 files changed, 13 insertions, 11 deletions
@@ -5,22 +5,24 @@ #include "wm.h" -static const char *status[] = { - "sh", "-c", "echo -n `date` `uptime | sed 's/.*://; s/,//g'`" - " `acpi | awk '{print $4}' | sed 's/,//'`", 0 \ -}; - void draw_bar() { - static char buf[1024]; - - buf[0] = 0; - pipe_spawn(buf, sizeof(buf), dpy, (char **)status); - brush.rect = barrect; brush.rect.x = brush.rect.y = 0; - draw(dpy, &brush, False, buf); + draw(dpy, &brush, False, NULL); + + if(stack) { + brush.rect.width = textwidth(&brush.font, stack->name) + labelheight(&brush.font); + swap((void **)&brush.fg, (void **)&brush.bg); + draw(dpy, &brush, False, stack->name); + swap((void **)&brush.fg, (void **)&brush.bg); + brush.rect.x += brush.rect.width; + } + + brush.rect.width = textwidth(&brush.font, statustext) + labelheight(&brush.font); + brush.rect.x = barrect.x + barrect.width - brush.rect.width; + draw(dpy, &brush, False, statustext); XCopyArea(dpy, brush.drawable, barwin, brush.gc, 0, 0, barrect.width, barrect.height, 0, 0); |