diff --git a/komorebi/src/main.rs b/komorebi/src/main.rs index f3dceb7a..218a87d7 100644 --- a/komorebi/src/main.rs +++ b/komorebi/src/main.rs @@ -328,6 +328,11 @@ fn main() -> Result<()> { tracing::error!("received ctrl-c, restoring all hidden windows and terminating process"); wm.lock().restore_all_windows(); + + if WindowsApi::focus_follows_mouse()? { + WindowsApi::disable_focus_follows_mouse()?; + } + std::process::exit(130); } diff --git a/komorebi/src/process_command.rs b/komorebi/src/process_command.rs index 7e9ef417..e017e91e 100644 --- a/komorebi/src/process_command.rs +++ b/komorebi/src/process_command.rs @@ -203,7 +203,6 @@ impl WindowManager { })?; self.focus_monitor(monitor_idx)?; - self.focus_workspace(workspace_idx)?; } SocketMessage::Stop => { @@ -211,6 +210,11 @@ impl WindowManager { "received stop command, restoring all hidden windows and terminating process" ); self.restore_all_windows(); + + if WindowsApi::focus_follows_mouse()? { + WindowsApi::disable_focus_follows_mouse()?; + } + std::process::exit(0) } SocketMessage::EnsureWorkspaces(monitor_idx, workspace_count) => {