From 127254b7ac726c615e1443119f24881221e59182 Mon Sep 17 00:00:00 2001 From: LGUG2Z Date: Mon, 1 Nov 2021 13:59:21 -0700 Subject: [PATCH] feat(wm): disable windows ffm on stop and ctrl-c This commit disables the native Windows ffm implementation as part of the stop command and the ctrl-c handler. resolve #69 --- komorebi/src/main.rs | 5 +++++ komorebi/src/process_command.rs | 6 +++++- 2 files changed, 10 insertions(+), 1 deletion(-) 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) => {