summaryrefslogtreecommitdiff
path: root/patch/killunsel.c
diff options
context:
space:
mode:
authorBear <bear@bengtsson.win>2021-12-27 09:29:58 +0000
committerBear <bear@bengtsson.win>2021-12-27 09:29:58 +0000
commit69262b01ced79c2d776fab9b889926d1816a1e7a (patch)
treef304cd6fa8734e83a7772d07dc9b484781565155 /patch/killunsel.c
Added DWM
Diffstat (limited to 'patch/killunsel.c')
-rw-r--r--patch/killunsel.c28
1 files changed, 28 insertions, 0 deletions
diff --git a/patch/killunsel.c b/patch/killunsel.c
new file mode 100644
index 0000000..8d7a7b8
--- /dev/null
+++ b/patch/killunsel.c
@@ -0,0 +1,28 @@
+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 BAR_SYSTRAY_PATCH
+ if (!sendevent(i->win, wmatom[WMDelete], NoEventMask, wmatom[WMDelete], CurrentTime, 0, 0, 0))
+ #else
+ if (!sendevent(i, wmatom[WMDelete]))
+ #endif // BAR_SYSTRAY_PATCH
+ {
+ XGrabServer(dpy);
+ XSetErrorHandler(xerrordummy);
+ XSetCloseDownMode(dpy, DestroyAll);
+ XKillClient(dpy, i->win);
+ XSync(dpy, False);
+ XSetErrorHandler(xerror);
+ XUngrabServer(dpy);
+ }
+ }
+ }
+}
+