diff --git a/dwm.c b/dwm.c index 133f420..56f9485 100644 --- a/dwm.c +++ b/dwm.c @@ -232,6 +232,7 @@ static Bool otherwm; static Bool running = True; static Client *clients = NULL; static Client *sel = NULL; +static Client *foc = NULL; static Client *stack = NULL; static Cursor cursor[CurLast]; static Display *dpy; @@ -627,8 +628,14 @@ focus(Client *c) { attachstack(c); grabbuttons(c, True); XSetWindowBorder(dpy, c->win, dc.sel[ColBorder]); - if(c->isfocusable) - XSetInputFocus(dpy, c->win, RevertToPointerRoot, CurrentTime); + if(c->isfocusable) { + if(foc && foc != c) + XSetWindowBorder(dpy, foc->win, dc.norm[ColBorder]); + foc = c; + XSetInputFocus(dpy, foc->win, RevertToPointerRoot, CurrentTime); + } + else if(foc) + XSetWindowBorder(dpy, foc->win, dc.sel[ColFG]); } else XSetInputFocus(dpy, root, RevertToPointerRoot, CurrentTime);