summaryrefslogtreecommitdiffstats
path: root/wm.c
diff options
context:
space:
mode:
Diffstat (limited to 'wm.c')
-rw-r--r--wm.c16
1 files changed, 12 insertions, 4 deletions
diff --git a/wm.c b/wm.c
index f247372..837be3c 100644
--- a/wm.c
+++ b/wm.c
@@ -27,7 +27,7 @@ XRectangle rect, barrect;
27Bool running = True; 27Bool running = True;
28Bool sel_screen; 28Bool sel_screen;
29 29
30char *bartext, tag[256]; 30char statustext[1024], tag[256];
31int screen; 31int screen;
32 32
33Brush brush = {0}; 33Brush brush = {0};
@@ -35,9 +35,15 @@ Client *clients = NULL;
35Client *stack = NULL; 35Client *stack = NULL;
36 36
37static Bool other_wm_running; 37static Bool other_wm_running;
38static char version[] = "gridwm - " VERSION ", (C)opyright MMVI Anselm R. Garbe\n"; 38static const char version[] = "gridwm - " VERSION ", (C)opyright MMVI Anselm R. Garbe\n";
39static int (*x_error_handler) (Display *, XErrorEvent *); 39static int (*x_error_handler) (Display *, XErrorEvent *);
40 40
41static const char *status[] = {
42 "sh", "-c", "echo -n `date '+%Y/%m/%d %H:%M'`"
43 " `uptime | sed 's/.*://; s/,//g'`"
44 " `acpi | awk '{print $4}' | sed 's/,//'`", 0
45};
46
41static void 47static void
42usage() 48usage()
43{ 49{
@@ -258,9 +264,9 @@ main(int argc, char *argv[])
258 barrect.width, barrect.height, 0, DefaultDepth(dpy, screen), 264 barrect.width, barrect.height, 0, DefaultDepth(dpy, screen),
259 CopyFromParent, DefaultVisual(dpy, screen), 265 CopyFromParent, DefaultVisual(dpy, screen),
260 CWOverrideRedirect | CWBackPixmap | CWEventMask, &wa); 266 CWOverrideRedirect | CWBackPixmap | CWEventMask, &wa);
261 bartext = NULL;
262 XDefineCursor(dpy, barwin, cursor[CurNormal]); 267 XDefineCursor(dpy, barwin, cursor[CurNormal]);
263 XMapRaised(dpy, barwin); 268 XMapRaised(dpy, barwin);
269 pipe_spawn(statustext, sizeof(statustext), dpy, (char **)status);
264 draw_bar(); 270 draw_bar();
265 271
266 wa.event_mask = SubstructureRedirectMask | EnterWindowMask \ 272 wa.event_mask = SubstructureRedirectMask | EnterWindowMask \
@@ -282,8 +288,10 @@ main(int argc, char *argv[])
282 t = timeout; 288 t = timeout;
283 if(select(ConnectionNumber(dpy) + 1, &fds, NULL, NULL, &t) > 0) 289 if(select(ConnectionNumber(dpy) + 1, &fds, NULL, NULL, &t) > 0)
284 continue; 290 continue;
285 else if(errno != EINTR) 291 else if(errno != EINTR) {
292 pipe_spawn(statustext, sizeof(statustext), dpy, (char **)status);
286 draw_bar(); 293 draw_bar();
294 }
287 } 295 }
288 296
289 cleanup(); 297 cleanup();