neodotfiles/source/dwm/patches/dwm-sendmon_keepfocus-6.2.diff

41 lines
791 B
Diff
Raw Normal View History

2024-08-13 13:07:56 +00:00
From 812695104701acaaa5b31afad08fdb576486ae72 Mon Sep 17 00:00:00 2001
From: Bakkeby <bakkeby@gmail.com>
Date: Thu, 27 Jun 2024 17:55:57 +0200
Subject: [PATCH] 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.45.2