summaryrefslogtreecommitdiffstats
path: root/wm.c
diff options
context:
space:
mode:
Diffstat (limited to '')
-rw-r--r--wm.c23
1 files changed, 10 insertions, 13 deletions
diff --git a/wm.c b/wm.c
index 82b2dee..f0069d2 100644
--- a/wm.c
+++ b/wm.c
@@ -23,12 +23,11 @@ Display *dpy;
23Window root, barwin; 23Window root, barwin;
24Atom wm_atom[WMLast], net_atom[NetLast]; 24Atom wm_atom[WMLast], net_atom[NetLast];
25Cursor cursor[CurLast]; 25Cursor cursor[CurLast];
26XRectangle rect, barrect;
27Bool running = True; 26Bool running = True;
28Bool sel_screen; 27Bool sel_screen;
29 28
30char statustext[1024], tag[256]; 29char statustext[1024], tag[256];
31int screen; 30int screen, sx, sy, sw, sh, bx, by, bw, bh;
32 31
33Brush brush = {0}; 32Brush brush = {0};
34Client *clients = NULL; 33Client *clients = NULL;
@@ -39,7 +38,7 @@ static const char version[] = "gridwm - " VERSION ", (C)opyright MMVI Anselm R.
39static int (*x_error_handler) (Display *, XErrorEvent *); 38static int (*x_error_handler) (Display *, XErrorEvent *);
40 39
41static const char *status[] = { 40static const char *status[] = {
42 "sh", "-c", "echo -n `date '+%Y/%m/%d %H:%M'`" 41 "sh", "-c", "echo -n `date '+%Y-%m-%d %H:%M'`"
43 " `uptime | sed 's/.*://; s/,//g'`" 42 " `uptime | sed 's/.*://; s/,//g'`"
44 " `acpi | awk '{print $4}' | sed 's/,//'`", 0 43 " `acpi | awk '{print $4}' | sed 's/,//'`", 0
45}; 44};
@@ -220,9 +219,9 @@ main(int argc, char *argv[])
220 if(other_wm_running) 219 if(other_wm_running)
221 error("gridwm: another window manager is already running\n"); 220 error("gridwm: another window manager is already running\n");
222 221
223 rect.x = rect.y = 0; 222 sx = sy = 0;
224 rect.width = DisplayWidth(dpy, screen); 223 sw = DisplayWidth(dpy, screen);
225 rect.height = DisplayHeight(dpy, screen); 224 sh = DisplayHeight(dpy, screen);
226 sel_screen = XQueryPointer(dpy, root, &w, &w, &i, &i, &i, &i, &mask); 225 sel_screen = XQueryPointer(dpy, root, &w, &w, &i, &i, &i, &i, &mask);
227 226
228 XSetErrorHandler(0); 227 XSetErrorHandler(0);
@@ -253,18 +252,16 @@ main(int argc, char *argv[])
253 wa.background_pixmap = ParentRelative; 252 wa.background_pixmap = ParentRelative;
254 wa.event_mask = ExposureMask; 253 wa.event_mask = ExposureMask;
255 254
256 barrect = rect; 255 bx = by = 0;
257 barrect.height = labelheight(&brush.font); 256 bw = sw;
258 barrect.y = rect.height - barrect.height; 257 bh = texth(&brush.font);
259 barwin = XCreateWindow(dpy, root, barrect.x, barrect.y, 258 barwin = XCreateWindow(dpy, root, bx, by, bw, bh, 0, DefaultDepth(dpy, screen),
260 barrect.width, barrect.height, 0, DefaultDepth(dpy, screen),
261 CopyFromParent, DefaultVisual(dpy, screen), 259 CopyFromParent, DefaultVisual(dpy, screen),
262 CWOverrideRedirect | CWBackPixmap | CWEventMask, &wa); 260 CWOverrideRedirect | CWBackPixmap | CWEventMask, &wa);
263 XDefineCursor(dpy, barwin, cursor[CurNormal]); 261 XDefineCursor(dpy, barwin, cursor[CurNormal]);
264 XMapRaised(dpy, barwin); 262 XMapRaised(dpy, barwin);
265 263
266 brush.drawable = XCreatePixmap(dpy, root, rect.width, barrect.height, 264 brush.drawable = XCreatePixmap(dpy, root, sw, bh, DefaultDepth(dpy, screen));
267 DefaultDepth(dpy, screen));
268 brush.gc = XCreateGC(dpy, root, 0, 0); 265 brush.gc = XCreateGC(dpy, root, 0, 0);
269 266
270 pipe_spawn(statustext, sizeof(statustext), dpy, (char **)status); 267 pipe_spawn(statustext, sizeof(statustext), dpy, (char **)status);