dwm-meillo

diff wm.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 3ef108a5ca0a
line diff
     1.1 --- a/wm.c	Tue Jul 11 18:19:01 2006 +0200
     1.2 +++ b/wm.c	Tue Jul 11 18:53:41 2006 +0200
     1.3 @@ -27,7 +27,7 @@
     1.4  Bool running = True;
     1.5  Bool sel_screen;
     1.6  
     1.7 -char *bartext, tag[256];
     1.8 +char statustext[1024], tag[256];
     1.9  int screen;
    1.10  
    1.11  Brush brush = {0};
    1.12 @@ -35,9 +35,15 @@
    1.13  Client *stack = NULL;
    1.14  
    1.15  static Bool other_wm_running;
    1.16 -static char version[] = "gridwm - " VERSION ", (C)opyright MMVI Anselm R. Garbe\n";
    1.17 +static const char version[] = "gridwm - " VERSION ", (C)opyright MMVI Anselm R. Garbe\n";
    1.18  static int (*x_error_handler) (Display *, XErrorEvent *);
    1.19  
    1.20 +static const char *status[] = {
    1.21 +	"sh", "-c", "echo -n `date '+%Y/%m/%d %H:%M'`" 
    1.22 +	" `uptime | sed 's/.*://; s/,//g'`"
    1.23 +	" `acpi | awk '{print $4}' | sed 's/,//'`", 0
    1.24 +};
    1.25 +
    1.26  static void
    1.27  usage()
    1.28  {
    1.29 @@ -258,9 +264,9 @@
    1.30  			barrect.width, barrect.height, 0, DefaultDepth(dpy, screen),
    1.31  			CopyFromParent, DefaultVisual(dpy, screen),
    1.32  			CWOverrideRedirect | CWBackPixmap | CWEventMask, &wa);
    1.33 -	bartext = NULL;
    1.34  	XDefineCursor(dpy, barwin, cursor[CurNormal]);
    1.35  	XMapRaised(dpy, barwin);
    1.36 +	pipe_spawn(statustext, sizeof(statustext), dpy, (char **)status);
    1.37  	draw_bar();
    1.38  
    1.39  	wa.event_mask = SubstructureRedirectMask | EnterWindowMask \
    1.40 @@ -282,8 +288,10 @@
    1.41  		t = timeout;
    1.42  		if(select(ConnectionNumber(dpy) + 1, &fds, NULL, NULL, &t) > 0)
    1.43  			continue;
    1.44 -		else if(errno != EINTR)
    1.45 +		else if(errno != EINTR) {
    1.46 +			pipe_spawn(statustext, sizeof(statustext), dpy, (char **)status);
    1.47  			draw_bar();
    1.48 +		}
    1.49  	}
    1.50  
    1.51  	cleanup();