diff --git a/config.def.h b/config.def.h index a9ac303..6496426 100644 --- a/config.def.h +++ b/config.def.h @@ -73,6 +73,7 @@ static Key keys[] = { { MODKEY, XK_Return, zoom, {0} }, { MODKEY, XK_Tab, view, {0} }, { MODKEY|ShiftMask, XK_c, killclient, {0} }, + { MODKEY|ShiftMask, XK_x, killunsel, {0} }, { MODKEY, XK_t, setlayout, {.v = &layouts[0]} }, { MODKEY, XK_f, setlayout, {.v = &layouts[1]} }, { MODKEY, XK_m, setlayout, {.v = &layouts[2]} }, diff --git a/dwm.c b/dwm.c index a5ce993..a310c29 100644 --- a/dwm.c +++ b/dwm.c @@ -178,6 +178,7 @@ static void grabkeys(void); static void incnmaster(const Arg *arg); static void keypress(XEvent *e); static void killclient(const Arg *arg); +static void killunsel(const Arg *arg); static void manage(Window w, XWindowAttributes *wa); static void mappingnotify(XEvent *e); static void maprequest(XEvent *e); @@ -1017,6 +1018,29 @@ killclient(const Arg *arg) } void +killunsel(const Arg *arg) +{ + Client *i = NULL; + + if (!selmon->sel) + return; + + for (i = selmon->clients; i; i = i->next) { + if (ISVISIBLE(i) && i != selmon->sel) { + if (!sendevent(i, wmatom[WMDelete])) { + XGrabServer(dpy); + XSetErrorHandler(xerrordummy); + XSetCloseDownMode(dpy, DestroyAll); + XKillClient(dpy, i->win); + XSync(dpy, False); + XSetErrorHandler(xerror); + XUngrabServer(dpy); + } + } + } +} + +void manage(Window w, XWindowAttributes *wa) { Client *c, *t = NULL;