X-Git-Url: https://jasonwoof.com/gitweb/?a=blobdiff_plain;f=scrotwm.c;h=26d240d8dee903ddea616fc171fdebe47b430614;hb=3ddac044c08bbb29b39f453c80a21e9cd7f936c9;hp=a20eebca0433da799d9c2c48de156efd8c334a39;hpb=04f3b6a33ccbcfdfd98fcfd283044e8d9368a06b;p=spectrwm.git diff --git a/scrotwm.c b/scrotwm.c index a20eebc..26d240d 100644 --- a/scrotwm.c +++ b/scrotwm.c @@ -129,6 +129,7 @@ char *bar_fonts[] = { /* terminal + args */ char *spawn_term[] = { "xterm", NULL }; +char *spawn_menu[] = { "dmenu_run", NULL }; struct ws_win { TAILQ_ENTRY(ws_win) entry; @@ -319,10 +320,12 @@ bar_setup(void) bar_height - 2, 1, bar_border, bar_color); bar_gc = XCreateGC(display, bar_window, 0, &bar_gcv); XSetFont(display, bar_gc, bar_fs->fid); + XSelectInput(display, bar_window, VisibilityChangeMask); if (bar_enabled) { height -= bar_height; /* correct screen height */ XMapWindow(display, bar_window); } + DNPRINTF(SWM_D_MISC, "bar_setup: bar_window %d\n", (int)bar_window); if (signal(SIGALRM, bar_signal) == SIG_ERR) err(1, "could not install bar_signal"); @@ -581,7 +584,8 @@ struct key { } keys[] = { /* modifier key function argument */ { MODKEY, XK_Return, swap_to_main, {0} }, - { MODKEY | ShiftMask, XK_Return, spawn, {.argv = spawn_term } }, + { MODKEY | ShiftMask, XK_Return, spawn, {.argv = spawn_term} }, + { MODKEY, XK_p, spawn, {.argv = spawn_menu} }, { MODKEY | ShiftMask, XK_q, quit, {0} }, { MODKEY, XK_m, focus, {.id = SWM_ARG_ID_FOCUSMAIN} }, { MODKEY, XK_1, switchws, {.id = 0} }, @@ -839,6 +843,16 @@ unmapnotify(XEvent *e) DNPRINTF(SWM_D_EVENT, "unmapnotify: window: %lu\n", e->xunmap.window); } +void +visibilitynotify(XEvent *e) +{ + DNPRINTF(SWM_D_EVENT, "visibilitynotify: window: %lu\n", e->xvisibility.window); + + if (e->xvisibility.window == bar_window && + e->xvisibility.state == VisibilityUnobscured) + bar_print(); +} + void (*handler[LASTEvent])(XEvent *) = { [Expose] = expose, [KeyPress] = keypress, @@ -852,6 +866,7 @@ void (*handler[LASTEvent])(XEvent *) = { [MapRequest] = maprequest, [PropertyNotify] = propertynotify, [UnmapNotify] = unmapnotify, + [VisibilityNotify] = visibilitynotify, }; int