dwm-killfocusnext-20211208-33a4918.diff - sites - public wiki contents of suckless.org
(HTM) git clone git://git.suckless.org/sites
(DIR) Log
(DIR) Files
(DIR) Refs
---
dwm-killfocusnext-20211208-33a4918.diff (1518B)
---
1 From 33a4918578a7c19ce358a0233d6731933999f105 Mon Sep 17 00:00:00 2001
2 From: Hai Nguyen <hhai2105@gmail.com>
3 Date: Wed, 8 Dec 2021 00:30:24 -0500
4 Subject: [PATCH] update focus to not change focus stack, change unmanage to
5 always move to the next visible client
6
7 ---
8 dwm.c | 13 +++++++++----
9 1 file changed, 9 insertions(+), 4 deletions(-)
10
11 diff --git a/dwm.c b/dwm.c
12 index 5e4d494..a2aabb4 100644
13 --- a/dwm.c
14 +++ b/dwm.c
15 @@ -793,8 +793,6 @@ focus(Client *c)
16 selmon = c->mon;
17 if (c->isurgent)
18 seturgent(c, 0);
19 - detachstack(c);
20 - attachstack(c);
21 grabbuttons(c, 1);
22 XSetWindowBorder(dpy, c->win, scheme[SchemeSel][ColBorder].pixel);
23 setfocus(c);
24 @@ -803,6 +801,8 @@ focus(Client *c)
25 XDeleteProperty(dpy, root, netatom[NetActiveWindow]);
26 }
27 selmon->sel = c;
28 + if(c && selmon->lt[selmon->sellt]->arrange == monocle)
29 + XRaiseWindow(dpy, c->win);
30 drawbars();
31 }
32
33 @@ -851,8 +851,8 @@ focusstack(const Arg *arg)
34 c = i;
35 }
36 if (c) {
37 - focus(c);
38 restack(selmon);
39 + focus(c);
40 }
41 }
42
43 @@ -1767,6 +1767,9 @@ unmanage(Client *c, int destroyed)
44 {
45 Monitor *m = c->mon;
46 XWindowChanges wc;
47 + int fullscreen = (selmon->sel == c && selmon->sel->isfullscreen)?1:0;
48 + Client *nc;
49 + for (nc = c->next; nc && !ISVISIBLE(nc); nc = nc->next);
50
51 detach(c);
52 detachstack(c);
53 @@ -1782,7 +1785,9 @@ unmanage(Client *c, int destroyed)
54 XUngrabServer(dpy);
55 }
56 free(c);
57 - focus(NULL);
58 + focus(nc);
59 + if(fullscreen)
60 + togglefullscreen();
61 updateclientlist();
62 arrange(m);
63 }
64 --
65 2.34.1
66