diff options
Diffstat (limited to 'wm.c')
| -rw-r--r-- | wm.c | 16 |
1 files changed, 12 insertions, 4 deletions
| @@ -27,7 +27,7 @@ XRectangle rect, barrect; | |||
| 27 | Bool running = True; | 27 | Bool running = True; |
| 28 | Bool sel_screen; | 28 | Bool sel_screen; |
| 29 | 29 | ||
| 30 | char *bartext, tag[256]; | 30 | char statustext[1024], tag[256]; |
| 31 | int screen; | 31 | int screen; |
| 32 | 32 | ||
| 33 | Brush brush = {0}; | 33 | Brush brush = {0}; |
| @@ -35,9 +35,15 @@ Client *clients = NULL; | |||
| 35 | Client *stack = NULL; | 35 | Client *stack = NULL; |
| 36 | 36 | ||
| 37 | static Bool other_wm_running; | 37 | static Bool other_wm_running; |
| 38 | static char version[] = "gridwm - " VERSION ", (C)opyright MMVI Anselm R. Garbe\n"; | 38 | static const char version[] = "gridwm - " VERSION ", (C)opyright MMVI Anselm R. Garbe\n"; |
| 39 | static int (*x_error_handler) (Display *, XErrorEvent *); | 39 | static int (*x_error_handler) (Display *, XErrorEvent *); |
| 40 | 40 | ||
| 41 | static 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 | |||
| 41 | static void | 47 | static void |
| 42 | usage() | 48 | usage() |
| 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(); |
