From: A-Larsen Date: Tue, 13 Oct 2026 14:28:05 +0000 (-0400) Subject: goto window dwm shortcut X-Git-Url: https://nyquistdev.net/git/?a=commitdiff_plain;h=26633f501d02097e27f54953ffa256b28c8bc366;p=dwm-config.git goto window dwm shortcut --- diff --git a/dwm b/dwm index 3f6f18e..8c55f19 100755 Binary files a/dwm and b/dwm differ diff --git a/dwm.c b/dwm.c index 5ad38e4..782a445 100644 --- a/dwm.c +++ b/dwm.c @@ -1099,24 +1099,28 @@ clientmessage(XEvent *e) || cme->data.l[2] == netatom[NetWMFullscreen]) setfullscreen(c, (cme->data.l[0] == 1 /* _NET_WM_STATE_ADD */ || (cme->data.l[0] == 2 /* _NET_WM_STATE_TOGGLE */ && !c->isfullscreen))); - } else if (cme->message_type == netatom[NetActiveWindow]) { -// /* cme->data.l[0] == 2 means it came from an external pager/script like wmctrl */ - if (cme->data.l[0] == 2) { - /* --- NATIVE TAG, MONITOR, AND MOUSE JUMP ON ACTIVATION --- */ - selmon = c->mon; - if (!(c->tags & selmon->tagset[selmon->seltags])) { - view(&(Arg){ .ui = c->tags }); - } - focus(c); - restack(selmon); + } else if (cme->message_type == netatom[NetActiveWindow]) { + /* cme->data.l[0] == 2 means it came from an external pager/script like wmctrl */ + if (cme->data.l[0] == 2) { + /* --- SAFE CROSS-MONITOR ACTIVATION --- */ + if (c->mon != selmon) { + unfocus(selmon->sel, 0); + selmon = c->mon; + } + if (!(c->tags & selmon->tagset[selmon->seltags])) { + view(&(Arg){ .ui = c->tags }); + } - /* Optional: Warp cursor to the center of the target monitor */ - XWarpPointer(dpy, None, root, 0, 0, 0, 0, - selmon->wx + selmon->ww / 2, - selmon->wy + selmon->wh / 2); - /* ------------------------------------------------------- */ + /* Warp pointer first to prevent focus-follows-mouse race conditions */ + XWarpPointer(dpy, None, root, 0, 0, 0, 0, + selmon->wx + selmon->ww / 2, + selmon->wy + selmon->wh / 2); - } else if (c != selmon->sel && !c->isurgent) + focus(c); + XSetInputFocus(dpy, c->win, RevertToPointerRoot, CurrentTime); + restack(selmon); + /* ------------------------------------- */ + } else if (c != selmon->sel && !c->isurgent) seturgent(c, 1); } } diff --git a/dwm.o b/dwm.o index ab42e77..265338e 100644 Binary files a/dwm.o and b/dwm.o differ