From bf16c08ba9cf09df507ed24462ed717f7be0376b Mon Sep 17 00:00:00 2001 From: Fuwn Date: Thu, 23 May 2024 17:05:49 -0700 Subject: feat(dwm.c): followclient follows on tagmon --- config.h | 5 +++-- dwm.c | 14 ++++++++++++-- 2 files changed, 15 insertions(+), 4 deletions(-) diff --git a/config.h b/config.h index 3140b32..8f56c2d 100644 --- a/config.h +++ b/config.h @@ -10,8 +10,9 @@ /* appearance */ /* followclient: - * 1: if sending a client to a new tag with no other clients, the view will - * follow the client + * 1: + * - the view will follow the client when sent to an empty tag + * - the focus and cursor will follow the client when sent to a new monitor * 0: default behaviour */ static const int followclient = 1; static unsigned int borderpx = 2; /* border pixel of windows */ diff --git a/dwm.c b/dwm.c index b73473b..6ae6288 100644 --- a/dwm.c +++ b/dwm.c @@ -2122,8 +2122,18 @@ sendmon(Client *c, Monitor *m) attachaside(c); attachstack(c); setclienttagprop(c); - focus(NULL); - arrange(NULL); + + if (followclient) { + focus(c); + arrange(NULL); + + if (c && c->mon == selmon) { + XWarpPointer(dpy, None, c->win, 0, 0, 0, 0, c->w / 2, c->h / 2); + } + } else { + focus(NULL); + arrange(NULL); + } } void -- cgit v1.2.3