summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorProsperousPotato <ProsperousPotato@users.noreply.github.com>2026-01-16 20:44:23 +0000
committerProsperousPotato <ProsperousPotato@users.noreply.github.com>2026-01-16 20:44:23 +0000
commit970a379007237c43a772cf3eab68e9f5ce7c10ff (patch)
tree7f8b7c9e7a9157c1adb729161b9ee3a7a18a324e
parent8c72b7fafafe5c7005b732ccc6b446f7c4f12caf (diff)
actually fix swapfocus frfr
-rw-r--r--dwm.c16
1 files changed, 7 insertions, 9 deletions
diff --git a/dwm.c b/dwm.c
index 371e558..758d052 100644
--- a/dwm.c
+++ b/dwm.c
@@ -2075,17 +2075,15 @@ spawn(const Arg *arg)
void
swapfocus()
{
- int n = 0;
Client *c;
- for(c = selmon->clients; c; c = c->next) if(ISVISIBLE(c)) n++;;
- if(n == 2) {
- Arg arg = {.i = +1};
- focusstack(&arg);
- } else {
- for(c = selmon->clients; c && c != prevclient; c = c->next);
- if(c == prevclient)
- focus(prevclient);
+ for(c = selmon->clients; c && c != prevclient; c = c->next);
+ if(c == prevclient && prevclient != selmon->sel) {
+ focus(prevclient);
+ XWarpPointer(dpy, None, selmon->sel->win, 0, 0, 0, 0, selmon->sel->w/2, selmon->sel->h/2);
+ return;
}
+ Arg arg = {.i = +1};
+ focusstack(&arg);
XWarpPointer(dpy, None, selmon->sel->win, 0, 0, 0, 0, selmon->sel->w/2, selmon->sel->h/2);
}