From: Jason Woofenden Date: Sat, 18 Apr 2015 05:38:51 +0000 (-0400) Subject: only buffer keypresses on new kbspawn() X-Git-Url: https://jasonwoof.com/gitweb/?p=dwm.git;a=commitdiff_plain;h=6857120180bace35d1bc88b0a298e61ef5fbe8d6 only buffer keypresses on new kbspawn() --- diff --git a/config.def.h b/config.def.h index 2dc0620..9d9a0e7 100644 --- a/config.def.h +++ b/config.def.h @@ -87,7 +87,7 @@ static const char *termcmd[] = { "env", (const char *)(&(WORKSPACE_NUMBER[0])), static Key keys[] = { /* modifier key function argument */ { 0, XK_F1, spawn, {.v = dmenucmd } }, - { 0, XK_F2, spawn, {.v = termcmd } }, + { 0, XK_F2, kbspawn, {.v = termcmd } }, { MODKEY, XK_b, togglebar, {0} }, { MODKEY, XK_n, focusstack, {.i = +1 } }, { MODKEY, XK_h, focusstack, {.i = 0 } }, diff --git a/dwm.c b/dwm.c index dc9f318..7b017cb 100644 --- a/dwm.c +++ b/dwm.c @@ -211,6 +211,7 @@ static void setmfact(const Arg *arg); static void setup(void); static void showhide(Client *c); static void sigchld(int unused); +static void kbspawn(const Arg *arg); static void spawn(const Arg *arg); static void tag(const Arg *arg); static void tagmon(const Arg *arg); @@ -1269,8 +1270,11 @@ maprequest(XEvent *e) { if(!XGetWindowAttributes(dpy, ev->window, &wa)) return; - if(wa.override_redirect) + if(wa.override_redirect) { + key_buffer_len = 0; + key_buffering = False; return; + } if(!wintoclient(ev->window)) manage(ev->window, &wa); } @@ -1795,6 +1799,14 @@ sigchld(int unused) { } void +kbspawn(const Arg *arg) { + key_buffering = True; + key_buffer_len = 0; + grab_typing_keys(); + spawn(arg); +} + +void spawn(const Arg *arg) { int tag = 0, i; if(arg->v == termcmd) { @@ -1809,9 +1821,6 @@ spawn(const Arg *arg) { } if(arg->v == dmenucmd) dmenumon[0] = '0' + selmon->num; - key_buffering = True; - key_buffer_len = 0; - grab_typing_keys(); if(fork() == 0) { if(dpy) close(ConnectionNumber(dpy));