Introduction
Introduction Statistics Contact Development Disclaimer Help
dwm-bulkill-systray-20231029-9f88553.diff - sites - public wiki contents of suc…
git clone git://git.suckless.org/sites
Log
Files
Refs
---
dwm-bulkill-systray-20231029-9f88553.diff (2778B)
---
1 From 82eb2e651e54560540e77ba5dd292803cec8a6e3 Mon Sep 17 00:00:00 2001
2 From: ysl2 <[email protected]>
3 Date: Sun, 29 Oct 2023 15:42:52 +0800
4 Subject: [PATCH] Give killclient an augument to control the beheviour: a…
5 == 0 for normal kill current client; arg.ui == 1 for kill other clients…
6 current tag (except current focusing client); arg.ui == 2 for kill all
7 clients in current tag (include focusing client).
8
9 ---
10 config.def.h | 2 ++
11 dwm.c | 31 ++++++++++++++++++++++++-------
12 2 files changed, 26 insertions(+), 7 deletions(-)
13
14 diff --git a/config.def.h b/config.def.h
15 index 750529d..ef1efe8 100644
16 --- a/config.def.h
17 +++ b/config.def.h
18 @@ -79,6 +79,8 @@ static const Key keys[] = {
19 { MODKEY, XK_Return, zoom, {0} …
20 { MODKEY, XK_Tab, view, {0} …
21 { MODKEY|ShiftMask, XK_c, killclient, {0} …
22 + { MODKEY|ControlMask, XK_c, killclient, {.ui = 1…
23 + { MODKEY|ShiftMask|ControlMask, XK_c, killclient, {.ui = 2…
24 { MODKEY, XK_t, setlayout, {.v …
25 { MODKEY, XK_f, setlayout, {.v …
26 { MODKEY, XK_m, setlayout, {.v …
27 diff --git a/dwm.c b/dwm.c
28 index f9e7e4a..9819ec5 100644
29 --- a/dwm.c
30 +++ b/dwm.c
31 @@ -199,6 +199,7 @@ static void grabbuttons(Client *c, int focused);
32 static void grabkeys(void);
33 static void incnmaster(const Arg *arg);
34 static void keypress(XEvent *e);
35 +static void killthis(Window w);
36 static void killclient(const Arg *arg);
37 static void manage(Window w, XWindowAttributes *wa);
38 static void mappingnotify(XEvent *e);
39 @@ -1131,22 +1132,38 @@ keypress(XEvent *e)
40 }
41
42 void
43 -killclient(const Arg *arg)
44 -{
45 - if (!selmon->sel)
46 - return;
47 -
48 - if (!sendevent(selmon->sel->win, wmatom[WMDelete], NoEventMask,…
49 +killthis(Window w) {
50 + if (!sendevent(w, wmatom[WMDelete], NoEventMask, wmatom[WMDelet…
51 XGrabServer(dpy);
52 XSetErrorHandler(xerrordummy);
53 XSetCloseDownMode(dpy, DestroyAll);
54 - XKillClient(dpy, selmon->sel->win);
55 + XKillClient(dpy, w);
56 XSync(dpy, False);
57 XSetErrorHandler(xerror);
58 XUngrabServer(dpy);
59 }
60 }
61
62 +void
63 +killclient(const Arg *arg)
64 +{
65 + Client *c;
66 +
67 + if (!selmon->sel)
68 + return;
69 +
70 + if (!arg->ui || arg->ui == 0) {
71 + killthis(selmon->sel->win);
72 + return;
73 + }
74 +
75 + for (c = selmon->clients; c; c = c->next) {
76 + if (!ISVISIBLE(c) || (arg->ui == 1 && c == selmon->sel))
77 + continue;
78 + killthis(c->win);
79 + }
80 +}
81 +
82 void
83 manage(Window w, XWindowAttributes *wa)
84 {
85 --
86 2.20.1
87
You are viewing proxied material from suckless.org. The copyright of proxied material belongs to its original authors. Any comments or complaints in relation to proxied material should be directed to the original authors of the content concerned. Please see the disclaimer for more details.