sites

public wiki contents of suckless.org
git clone git://git.suckless.org/sites
Log | Files | Refs

dwm-killunsel-ceac8c91ff.diff (1667B)


      1 diff --git a/config.def.h b/config.def.h
      2 index a9ac303..6496426 100644
      3 --- a/config.def.h
      4 +++ b/config.def.h
      5 @@ -73,6 +73,7 @@ static Key keys[] = {
      6  	{ MODKEY,                       XK_Return, zoom,           {0} },
      7  	{ MODKEY,                       XK_Tab,    view,           {0} },
      8  	{ MODKEY|ShiftMask,             XK_c,      killclient,     {0} },
      9 +	{ MODKEY|ShiftMask,             XK_x,      killunsel,      {0} },
     10  	{ MODKEY,                       XK_t,      setlayout,      {.v = &layouts[0]} },
     11  	{ MODKEY,                       XK_f,      setlayout,      {.v = &layouts[1]} },
     12  	{ MODKEY,                       XK_m,      setlayout,      {.v = &layouts[2]} },
     13 diff --git a/dwm.c b/dwm.c
     14 index a5ce993..a310c29 100644
     15 --- a/dwm.c
     16 +++ b/dwm.c
     17 @@ -178,6 +178,7 @@ static void grabkeys(void);
     18  static void incnmaster(const Arg *arg);
     19  static void keypress(XEvent *e);
     20  static void killclient(const Arg *arg);
     21 +static void killunsel(const Arg *arg);
     22  static void manage(Window w, XWindowAttributes *wa);
     23  static void mappingnotify(XEvent *e);
     24  static void maprequest(XEvent *e);
     25 @@ -1017,6 +1018,29 @@ killclient(const Arg *arg)
     26  }
     27  
     28  void
     29 +killunsel(const Arg *arg)
     30 +{
     31 +	Client *i = NULL;
     32 +
     33 +	if (!selmon->sel)
     34 +		return;
     35 +
     36 +	for (i = selmon->clients; i; i = i->next) {
     37 +		if (ISVISIBLE(i) && i != selmon->sel) {
     38 +			if (!sendevent(i, wmatom[WMDelete])) {
     39 +				XGrabServer(dpy);
     40 +				XSetErrorHandler(xerrordummy);
     41 +				XSetCloseDownMode(dpy, DestroyAll);
     42 +				XKillClient(dpy, i->win);
     43 +				XSync(dpy, False);
     44 +				XSetErrorHandler(xerror);
     45 +				XUngrabServer(dpy);
     46 +			}
     47 +		}
     48 +	}
     49 +}
     50 +
     51 +void
     52  manage(Window w, XWindowAttributes *wa)
     53  {
     54  	Client *c, *t = NULL;