2
0
mirror of https://github.com/bakkeby/patches synced 2024-11-17 15:29:53 +00:00
patches/dwm/dwm-sendmon_keepfocus-6.2.diff

41 lines
798 B
Diff

From 8267779708a52b35fd30d1c1ec7451c192d45068 Mon Sep 17 00:00:00 2001
From: bakkeby <bakkeby@gmail.com>
Date: Wed, 24 Jun 2020 17:15:36 +0200
Subject: [PATCH] Adding sendmon_keepfocus patch
---
dwm.c | 10 ++++++++--
1 file changed, 8 insertions(+), 2 deletions(-)
diff --git a/dwm.c b/dwm.c
index 4465af1..2def4a1 100644
--- a/dwm.c
+++ b/dwm.c
@@ -1412,15 +1412,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
--
2.19.1