diff options
Diffstat (limited to 'dwm.c')
-rw-r--r-- | dwm.c | 14 |
1 files changed, 12 insertions, 2 deletions
@@ -2072,15 +2072,25 @@ 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 |