From dd4d93bc94c2e8f7e9ee8beeebdb2a4a2f34d64f Mon Sep 17 00:00:00 2001 From: Federico Terzi Date: Sun, 27 Jun 2021 20:19:31 +0200 Subject: [PATCH] fix(core): reduce timeout for broadcast message when adding espanso to PATH on Windows --- espanso/src/path/win.rs | 17 ++++++++++++++--- 1 file changed, 14 insertions(+), 3 deletions(-) diff --git a/espanso/src/path/win.rs b/espanso/src/path/win.rs index 7d4ea31..0119d74 100644 --- a/espanso/src/path/win.rs +++ b/espanso/src/path/win.rs @@ -44,7 +44,10 @@ pub fn add_espanso_to_path(_: bool) -> Result<()> { pub fn remove_espanso_from_path(_: bool) -> Result<()> { let paths = read_paths(); - let paths_without_espanso: Vec = paths.into_iter().filter(|path| !path.contains("espanso")).collect(); + let paths_without_espanso: Vec = paths + .into_iter() + .filter(|path| !path.contains("espanso")) + .collect(); let path = paths_without_espanso.join(";"); write_user_path_value(path) } @@ -76,6 +79,14 @@ fn send_change_broadcast() { unsafe { let mut res: usize = 0; - SendMessageTimeoutW(HWND_BROADCAST, WM_SETTINGCHANGE, 0, wide_string.as_ptr() as isize, 2, 1000, &mut res); + SendMessageTimeoutW( + HWND_BROADCAST, + WM_SETTINGCHANGE, + 0, + wide_string.as_ptr() as isize, + 2, + 50, + &mut res, + ); } -} \ No newline at end of file +}