X-Git-Url: https://jasonwoof.com/gitweb/?a=blobdiff_plain;f=scrotwm.c;h=64366e9834eb2b2701ea123a6fa501ea070f7425;hb=3356f1ccd4f323baa9accda99795d5377f9a24ba;hp=55b889699c04a9c6d0c5ca0bebb2c30f9f24393b;hpb=6d109bd69200cccec6ec77834195af993dfa6b7b;p=spectrwm.git diff --git a/scrotwm.c b/scrotwm.c index 55b8896..64366e9 100644 --- a/scrotwm.c +++ b/scrotwm.c @@ -50,7 +50,7 @@ static const char *cvstag = "$scrotwm$"; -#define SWM_VERSION "0.9" +#define SWM_VERSION "0.9.1" #include #include @@ -173,13 +173,14 @@ int bar_extra = 1; int bar_extra_running = 0; int bar_verbose = 1; int bar_height = 0; +int clock_enabled = 1; pid_t bar_pid; GC bar_gc; XGCValues bar_gcv; int bar_fidx = 0; XFontStruct *bar_fs; char *bar_fonts[] = { - "-*-terminus-*-*-*-*-*-*-*-*-*-*-*-*", + "-*-terminus-medium-*-*-*-*-*-*-*-*-*-*-*", "-*-times-medium-r-*-*-*-*-*-*-*-*-*-*", NULL }; @@ -552,7 +553,9 @@ conf_load(char *filename) break; case 'c': - if (!varmatch(var, "color_focus", &i)) + if (!strncmp(var, "clock_enabled", strlen("clock_enabled"))) + clock_enabled = atoi(val); + else if (!varmatch(var, "color_focus", &i)) setscreencolor(val, i, SWM_S_COLOR_FOCUS); else if (!varmatch(var, "color_unfocus", &i)) setscreencolor(val, i, SWM_S_COLOR_UNFOCUS); @@ -695,14 +698,18 @@ bar_update(void) } else strlcpy(bar_ext, "", sizeof bar_ext); - time(&tmt); - localtime_r(&tmt, &tm); - strftime(s, sizeof s, "%a %b %d %R %Z %Y", &tm); + if (clock_enabled == 0) + strlcpy(s, "", sizeof s); + else { + time(&tmt); + localtime_r(&tmt, &tm); + strftime(s, sizeof s, "%a %b %d %R %Z %Y ", &tm); + } for (i = 0; i < ScreenCount(display); i++) { x = 1; TAILQ_FOREACH(r, &screens[i].rl, entry) { - snprintf(loc, sizeof loc, "%s %d:%d %s %s", - s, x++, r->ws->idx + 1, bar_ext, bar_vertext); + snprintf(loc, sizeof loc, "%d:%d %s%s %s", + x++, r->ws->idx + 1, s, bar_ext, bar_vertext); bar_print(r, loc); } } @@ -2486,13 +2493,15 @@ configurenotify(XEvent *e) DNPRINTF(SWM_D_EVENT, "configurenotify: window: %lu\n", e->xconfigure.window); + XMapWindow(display, e->xconfigure.window); win = find_window(e->xconfigure.window); - XMapWindow(display, win->id); - XGetWMNormalHints(display, win->id, &win->sh, &mask); - adjust_font(win); - XMapWindow(display, win->id); - if (font_adjusted) - stack(); + if (win) { + XGetWMNormalHints(display, win->id, &win->sh, &mask); + adjust_font(win); + XMapWindow(display, win->id); + if (font_adjusted) + stack(); + } } void