summaryrefslogtreecommitdiff
path: root/dwm/patches/dwm-bulkill-20231029-9f88553.diff
diff options
context:
space:
mode:
authorTheSiahxyz <164138827+TheSiahxyz@users.noreply.github.com>2025-03-08 15:21:28 +0900
committerTheSiahxyz <164138827+TheSiahxyz@users.noreply.github.com>2025-03-08 15:21:28 +0900
commit4437d5b3c3eea76f6e2b0fd4a2ba21c02a098aeb (patch)
treee8dcb20bf144aacf88f93b012dccacdeb08015cd /dwm/patches/dwm-bulkill-20231029-9f88553.diff
parentc2b06f0d5795a789f4ddab459179ff89aedfee98 (diff)
updates
Diffstat (limited to 'dwm/patches/dwm-bulkill-20231029-9f88553.diff')
-rw-r--r--dwm/patches/dwm-bulkill-20231029-9f88553.diff85
1 files changed, 85 insertions, 0 deletions
diff --git a/dwm/patches/dwm-bulkill-20231029-9f88553.diff b/dwm/patches/dwm-bulkill-20231029-9f88553.diff
new file mode 100644
index 0000000..d4e6bc9
--- /dev/null
+++ b/dwm/patches/dwm-bulkill-20231029-9f88553.diff
@@ -0,0 +1,85 @@
+# From 70a21457fdbcbcdf26efb1329dd29872b7fcd8e3 Mon Sep 17 00:00:00 2001
+# From: ysl2 <www.songli.yu@gmail.com>
+# Date: Sun, 29 Oct 2023 15:45:05 +0800
+# Subject: [PATCH] Give killclient an augument to control the beheviour: arg.ui
+# == 0 for normal kill current client; arg.ui == 1 for kill other clients in
+# current tag (except current focusing client); arg.ui == 2 for kill all
+# clients in current tag (include focusing client).
+#
+# ---
+# config.def.h | 2 ++
+# dwm.c | 30 ++++++++++++++++++++++++------
+# 2 files changed, 26 insertions(+), 6 deletions(-)
+
+diff --git a/config.def.h b/config.def.h
+index 9efa774..d39e6dd 100644
+--- a/config.def.h
++++ b/config.def.h
+@@ -74,6 +74,8 @@ static const Key keys[] = {
+ { MODKEY, XK_Return, zoom, {0} },
+ { MODKEY, XK_Tab, view, {0} },
+ { MODKEY|ShiftMask, XK_c, killclient, {0} },
++ { MODKEY|ControlMask, XK_c, killclient, {.ui = 1} }, // kill unselect
++ { MODKEY|ShiftMask|ControlMask, XK_c, killclient, {.ui = 2} }, // killall
+ { 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 f1d86b2..011744d 100644
+--- a/dwm.c
++++ b/dwm.c
+@@ -177,6 +177,7 @@ static void grabbuttons(Client *c, int focused);
+ static void grabkeys(void);
+ static void incnmaster(const Arg *arg);
+ static void keypress(XEvent *e);
++static void killthis(Client *c);
+ static void killclient(const Arg *arg);
+ static void manage(Window w, XWindowAttributes *wa);
+ static void mappingnotify(XEvent *e);
+@@ -1013,21 +1014,38 @@ keypress(XEvent *e)
+ }
+
+ void
+-killclient(const Arg *arg)
+-{
+- if (!selmon->sel)
+- return;
+- if (!sendevent(selmon->sel, wmatom[WMDelete])) {
++killthis(Client *c) {
++ if (!sendevent(c, wmatom[WMDelete])) {
+ XGrabServer(dpy);
+ XSetErrorHandler(xerrordummy);
+ XSetCloseDownMode(dpy, DestroyAll);
+- XKillClient(dpy, selmon->sel->win);
++ XKillClient(dpy, c->win);
+ XSync(dpy, False);
+ XSetErrorHandler(xerror);
+ XUngrabServer(dpy);
+ }
+ }
+
++void
++killclient(const Arg *arg)
++{
++ Client *c;
++
++ if (!selmon->sel)
++ return;
++
++ if (!arg->ui || arg->ui == 0) {
++ killthis(selmon->sel);
++ return;
++ }
++
++ for (c = selmon->clients; c; c = c->next) {
++ if (!ISVISIBLE(c) || (arg->ui == 1 && c == selmon->sel))
++ continue;
++ killthis(c);
++ }
++}
++
+ void
+ manage(Window w, XWindowAttributes *wa)
+ {
+--
+2.20.1