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.
This commit is contained in:
LGUG2Z
2021-08-05 09:52:01 -07:00
parent 73568922d5
commit da8214cdc7

View File

@@ -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()?;