summaryrefslogtreecommitdiff
path: root/dwm.c
diff options
context:
space:
mode:
authorProsperousPotato <ProsperousPotato@users.noreply.github.com>2025-12-31 22:45:40 +0000
committerProsperousPotato <ProsperousPotato@users.noreply.github.com>2025-12-31 22:45:40 +0000
commitf9bc705314a667085c12784d23ab8a4192d18c3f (patch)
tree394a9d14e55c38cefcfb0d095b56c4672c267ec9 /dwm.c
parent4aa7d94347b2dc940901d6e073a65df75ae04829 (diff)
focus follows sendmon
Diffstat (limited to 'dwm.c')
-rw-r--r--dwm.c10
1 files changed, 8 insertions, 2 deletions
diff --git a/dwm.c b/dwm.c
index ec11435..5053619 100644
--- a/dwm.c
+++ b/dwm.c
@@ -1646,15 +1646,21 @@ sendmon(Client *c, Monitor *m)
{
if (c->mon == m)
return;
+ int hadfocus = (c == selmon->sel);
unfocus(c, 1);
detach(c);
detachstack(c);
+ arrange(c->mon);
c->mon = m;
c->tags = m->tagset[m->seltags]; /* assign tags of target monitor */
attach(c);
attachstack(c);
- focus(NULL);
- arrange(NULL);
+ arrange(m);
+ if (hadfocus) {
+ focus(c);
+ restack(m);
+ } else
+ focus(NULL);
}
void