You are not logged in.

#1 2021-12-03 17:20:58

xabdax
Member
Registered: 2021-09-12
Posts: 4

Modify the killclient in DWM to allow for an exception

I keep closing VIM accidentally using the key binding that triggers the killclient in DWM so I was hoping to modify that function in order to allow for an exception. The function is given below:

 
killclient(const Arg *arg)
{
	if (!selmon->sel)
		return;
	if (!sendevent(selmon->sel, wmatom[WMDelete])) {
		XGrabServer(dpy);
		XSetErrorHandler(xerrordummy);
		XSetCloseDownMode(dpy, DestroyAll);
		XKillClient(dpy, selmon->sel->win);
		XSync(dpy, False);
		XSetErrorHandler(xerror);
		XUngrabServer(dpy);
	}
}

I would then only be able to close VIM using its inbuilt commands (such as :q).

Can somebody explain to me how I would have to modify the function above to make an exception for VIM? I don't run into the same problem with other programs as they, unlike VIM, usually require me to confirm that I want to close this window.

Offline

#2 2021-12-03 17:29:29

jasonwryan
Anarchist
From: .nz
Registered: 2009-05-09
Posts: 30,426
Website

Re: Modify the killclient in DWM to allow for an exception

Just rebind killclient to something you are unlikely to use inadvertently.


Arch + dwm   •   Mercurial repos  •   Surfraw

Registered Linux User #482438

Offline

#3 2021-12-03 17:31:52

xabdax
Member
Registered: 2021-09-12
Posts: 4

Re: Modify the killclient in DWM to allow for an exception

Well, running code in VIM frequently opens up plots that I like to close using that key binding, so rebinding would probably not solve my issue

Offline

Board footer

Powered by FluxBB