mirror of
https://github.com/Gerg-L/nixos.git
synced 2025-12-10 00:43:56 -05:00
42 lines
1.5 KiB
Diff
42 lines
1.5 KiB
Diff
diff --git a/dwm.c b/dwm.c
|
|
index 49fd937..ed7ec01 100644
|
|
--- a/dwm.c
|
|
+++ b/dwm.c
|
|
@@ -248,6 +248,7 @@ static void zoom(const Arg *arg);
|
|
/* variables */
|
|
static const char autostartblocksh[] = "autostart_blocking.sh";
|
|
static const char autostartsh[] = "autostart.sh";
|
|
+static Client *lastfocused = NULL;
|
|
static const char broken[] = "broken";
|
|
static const char dwmdir[] = "dwm";
|
|
static const char localshare[] = ".local/share";
|
|
@@ -796,7 +797,11 @@ focus(Client *c)
|
|
detachstack(c);
|
|
attachstack(c);
|
|
grabbuttons(c, 1);
|
|
+ /* set new focused border first to avoid flickering */
|
|
XSetWindowBorder(dpy, c->win, scheme[SchemeSel][ColBorder].pixel);
|
|
+ /* lastfocused may be us if another window was unmanaged */
|
|
+ if (lastfocused && lastfocused != c)
|
|
+ XSetWindowBorder(dpy, lastfocused->win, scheme[SchemeNorm][ColBorder].pixel);
|
|
if (!selmon->drawwithgaps && !c->isfloating) {
|
|
XWindowChanges wc;
|
|
wc.sibling = selmon->barwin;
|
|
@@ -1875,7 +1880,7 @@ unfocus(Client *c, int setfocus)
|
|
if (!c)
|
|
return;
|
|
grabbuttons(c, 0);
|
|
- XSetWindowBorder(dpy, c->win, scheme[SchemeNorm][ColBorder].pixel);
|
|
+ lastfocused = c;
|
|
if (setfocus) {
|
|
XSetInputFocus(dpy, root, RevertToPointerRoot, CurrentTime);
|
|
XDeleteProperty(dpy, root, netatom[NetActiveWindow]);
|
|
@@ -1902,6 +1907,8 @@ unmanage(Client *c, int destroyed)
|
|
XSetErrorHandler(xerror);
|
|
XUngrabServer(dpy);
|
|
}
|
|
+ if (lastfocused == c)
|
|
+ lastfocused = NULL;
|
|
free(c);
|
|
focus(NULL);
|
|
updateclientlist();
|