fix(wm): unmanage multi-window exes on hide

Looks like explorer.exe is not the only one. Making the comparison
against a list instead.
This commit is contained in:
LGUG2Z
2021-07-30 10:59:19 -07:00
parent b0c3480262
commit d8a717950c
2 changed files with 11 additions and 3 deletions

View File

@@ -41,6 +41,12 @@ lazy_static! {
static ref FLOAT_TITLES: Arc<Mutex<Vec<String>>> = Arc::new(Mutex::new(vec![]));
static ref LAYERED_EXE_WHITELIST: Arc<Mutex<Vec<String>>> =
Arc::new(Mutex::new(vec!["steam.exe".to_string()]));
static ref MULTI_WINDOW_EXES: Arc<Mutex<Vec<String>>> = Arc::new(Mutex::new(vec![
"explorer.exe".to_string(),
"firefox.exe".to_string(),
"chrome.exe".to_string(),
"idea64.exe".to_string()
]));
}
fn setup() -> Result<WorkerGuard> {

View File

@@ -8,6 +8,7 @@ use crossbeam_channel::select;
use crate::window_manager::WindowManager;
use crate::window_manager_event::WindowManagerEvent;
use crate::MULTI_WINDOW_EXES;
pub fn listen_for_events(wm: Arc<Mutex<WindowManager>>) {
let receiver = wm.lock().unwrap().incoming_events.lock().unwrap().clone();
@@ -82,9 +83,10 @@ impl WindowManager {
}
WindowManagerEvent::Hide(_, window) => {
// explorer.exe is always returns true even if it's running in the background,
// but we want to be able to handle the event when File Explorer windows close properly
if !window.is_window() || window.exe()? == "explorer.exe" {
// Some major applications unfortunately send the HIDE signal when they are being
// minimized or destroyed. Will have to keep updating this list.
let common_multi_window_exes = MULTI_WINDOW_EXES.lock().unwrap();
if !window.is_window() || common_multi_window_exes.contains(&window.exe()?) {
self.focused_workspace_mut()?.remove_window(window.hwnd)?;
self.update_focused_workspace(false)?;
}