From da8214cdc79af233d5d3273762b28788833811b1 Mon Sep 17 00:00:00 2001 From: LGUG2Z Date: Thu, 5 Aug 2021 09:52:01 -0700 Subject: [PATCH] fix(wm): switch only to different workspaces Previously a Show event when clicking Firefox tabs would trigger a refocusing of monitors and workspaces every time for a known hwnd, which meant that in practice, the tab would be taken out of the current window and a new window would be created. This commit ensures that the workspace switch is only done if it would be to a different monitor/workspace combination. --- komorebi/src/process_event.rs | 14 +++++++++++--- 1 file changed, 11 insertions(+), 3 deletions(-) diff --git a/komorebi/src/process_event.rs b/komorebi/src/process_event.rs index c4aeb3eb..1131d870 100644 --- a/komorebi/src/process_event.rs +++ b/komorebi/src/process_event.rs @@ -116,9 +116,17 @@ impl WindowManager { } if let Some(indices) = switch_to { - self.focus_monitor(indices.0)?; - self.focus_workspace(indices.1)?; - return Ok(()); + if self.focused_monitor_idx() != indices.0 + && self + .focused_monitor() + .context("there is no monitor")? + .focused_workspace_idx() + != indices.1 + { + self.focus_monitor(indices.0)?; + self.focus_workspace(indices.1)?; + return Ok(()); + } } let workspace = self.focused_workspace_mut()?;