X-Git-Url: https://jasonwoof.com/gitweb/?a=blobdiff_plain;f=scrotwm.c;h=45e0787a6940fed9060ba050c2cac5befbd10702;hb=08c761d14b4c40dcf0be20dc5fc1ae71f81eff12;hp=c672715a1ea65e764d3a468590a8bd1aa70d14de;hpb=3c32a5f62dc1dc0277a4235c9749eaddd5b35058;p=spectrwm.git diff --git a/scrotwm.c b/scrotwm.c index c672715..45e0787 100644 --- a/scrotwm.c +++ b/scrotwm.c @@ -155,6 +155,9 @@ bar_print(void) time_t tmt; struct tm tm; + if (bar_enabled == 0) + return; + /* clear old text */ XSetForeground(display, bar_gc, 0x000000); XDrawString(display, bar_window, bar_gc, 4, bar_fs->ascent, bar_text, @@ -180,6 +183,30 @@ bar_signal(int sig) } void +bar_toggle(union arg *args) +{ + int i; + + DNPRINTF(SWM_D_MISC, "bar_toggle\n"); + + if (bar_enabled) { + bar_enabled = 0; + height += bar_height; /* correct screen height */ + XUnmapWindow(display, bar_window); + } else { + bar_enabled = 1; + height -= bar_height; /* correct screen height */ + XMapWindow(display, bar_window); + } + XSync(display, False); + for (i = 0; i < SWM_WS_MAX; i++) + ws[i].restack = 1; + + stack(); + bar_print(); /* must be after stack */ +} + +void quit(union arg *args) { DNPRINTF(SWM_D_MISC, "quit\n"); @@ -251,6 +278,7 @@ switchws(union arg *args) ignore_enter = 1; if (ws[wsid].restack) { stack(); + bar_print(); } else { if (ws[wsid].focus != NULL) focus_win(ws[wsid].focus); @@ -311,6 +339,8 @@ stack(void) winfocus->id = root; + ws[current_ws].restack = 0; + if (ws[current_ws].winno == 0) return; @@ -325,7 +355,7 @@ stack(void) hrh = 0; x = 0; - y = bar_height; + y = bar_enabled ? bar_height : 0; h = height; i = 0; TAILQ_FOREACH (win, &ws[current_ws].winlist, entry) { @@ -419,7 +449,6 @@ send_to_ws(union arg *args) stack(); } - /* terminal + args */ char *term[] = { "xterm", NULL }; @@ -455,6 +484,7 @@ struct key { { MODKEY | ShiftMask, XK_8, send_to_ws, {.id = 7} }, { MODKEY | ShiftMask, XK_9, send_to_ws, {.id = 8} }, { MODKEY | ShiftMask, XK_0, send_to_ws, {.id = 9} }, + { MODKEY, XK_b, bar_toggle, {0} }, { MODKEY, XK_Tab, focus, {.id = SWM_ARG_ID_FOCUSNEXT} }, { MODKEY | ShiftMask, XK_Tab, focus, {.id = SWM_ARG_ID_FOCUSPREV} }, };