annotate bar.c @ 14:5c078b66347b
added bar event timer
author |
Anselm R. Garbe <garbeam@wmii.de> |
date |
Tue, 11 Jul 2006 18:15:11 +0200 |
parents |
e5018cae273f |
children |
359b6e563b95 |
rev |
line source |
garbeam@5
|
1 /*
|
garbeam@5
|
2 * (C)opyright MMVI Anselm R. Garbe <garbeam at gmail dot com>
|
garbeam@5
|
3 * See LICENSE file for license details.
|
garbeam@5
|
4 */
|
garbeam@5
|
5
|
garbeam@5
|
6 #include "wm.h"
|
garbeam@5
|
7
|
garbeam@14
|
8 static const char *status[] = {
|
garbeam@14
|
9 "sh", "-c", "echo -n `date` `uptime | sed 's/.*://; s/,//g'`"
|
garbeam@14
|
10 " `acpi | awk '{print $4}' | sed 's/,//'`", 0 \
|
garbeam@14
|
11 };
|
garbeam@14
|
12
|
garbeam@5
|
13 void
|
garbeam@5
|
14 draw_bar()
|
garbeam@5
|
15 {
|
garbeam@14
|
16 static char buf[1024];
|
garbeam@14
|
17
|
garbeam@14
|
18 buf[0] = 0;
|
garbeam@14
|
19 pipe_spawn(buf, sizeof(buf), dpy, (char **)status);
|
garbeam@14
|
20
|
garbeam@5
|
21 brush.rect = barrect;
|
garbeam@5
|
22 brush.rect.x = brush.rect.y = 0;
|
garbeam@14
|
23 draw(dpy, &brush, False, buf);
|
garbeam@5
|
24
|
garbeam@5
|
25 XCopyArea(dpy, brush.drawable, barwin, brush.gc, 0, 0, barrect.width,
|
garbeam@5
|
26 barrect.height, 0, 0);
|
garbeam@5
|
27 XFlush(dpy);
|
garbeam@5
|
28 }
|