From 5eab604a105f10f2ae275f2c05989ccd19b3373a Mon Sep 17 00:00:00 2001 From: Orestis Floros Date: Sat, 11 Apr 2020 11:10:51 +0200 Subject: [PATCH] floating_maybe_reassign_ws: only re-focus if previously focused Fixes #3979 --- src/floating.c | 10 ++++++++-- 1 file changed, 8 insertions(+), 2 deletions(-) diff --git a/src/floating.c b/src/floating.c index 2bf9ae94..d12aabc4 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; }