aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorOrestis Floros <orestisflo@gmail.com>2020-04-11 11:10:51 +0200
committerMichael Stapelberg <michael@stapelberg.de>2020-07-22 09:24:24 +0200
commit96639c04106de630efa0eee1662f5f049e4a324d (patch)
tree4818a5457b2561bf5f7e2e5dbf27a9a3cbe06001
parentdae37a902b9826fb846a87597657ee2d36c291d7 (diff)
downloadi3-96639c04106de630efa0eee1662f5f049e4a324d.tar.gz
i3-96639c04106de630efa0eee1662f5f049e4a324d.zip
floating_maybe_reassign_ws: only re-focus if previously focused
Fixes #3979
-rw-r--r--src/floating.c10
1 files changed, 8 insertions, 2 deletions
diff --git a/src/floating.c b/src/floating.c
index bd52cdb6..bb6c644c 100644
--- a/src/floating.c
+++ b/src/floating.c
@@ -514,9 +514,15 @@ bool floating_maybe_reassign_ws(Con *con) {
Con *content = output_get_content(output->con);
Con *ws = TAILQ_FIRST(&(content->focus_head));
DLOG("Moving con %p / %s to workspace %p / %s\n", con, con->name, ws, ws->name);
+ Con *needs_focus = con_descend_focused(con);
+ if (!con_inside_focused(needs_focus)) {
+ needs_focus = NULL;
+ }
con_move_to_workspace(con, ws, false, true, false);
- workspace_show(ws);
- con_activate(con_descend_focused(con));
+ if (needs_focus) {
+ workspace_show(ws);
+ con_activate(needs_focus);
+ }
return true;
}