From 87dd7646fc9223ac7e67842934f3bd104b4eea80 Mon Sep 17 00:00:00 2001 From: Jake Stanger Date: Sun, 16 Jul 2023 20:24:23 +0100 Subject: [PATCH 1/2] fix(launcher): not clearing focused state when closing window Fixes #213. Fixes partially #225. --- src/modules/launcher/mod.rs | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/src/modules/launcher/mod.rs b/src/modules/launcher/mod.rs index d2016ae..5fded46 100644 --- a/src/modules/launcher/mod.rs +++ b/src/modules/launcher/mod.rs @@ -381,8 +381,12 @@ impl Module for LauncherModule { } } } - LauncherUpdate::RemoveWindow(app_id, _) => { + LauncherUpdate::RemoveWindow(app_id, win_id) => { + debug!("Removing window {win_id} with id {app_id}"); + if let Some(button) = buttons.get(&app_id) { + button.set_focused(false); + let mut menu_state = write_lock!(button.menu_state); menu_state.num_windows -= 1; } From 6f57ad47ac30348c0ae2b7dba35d5ffdbf96f72d Mon Sep 17 00:00:00 2001 From: Jake Stanger Date: Sun, 16 Jul 2023 20:38:16 +0100 Subject: [PATCH 2/2] fix(launcher): not setting focus state when opening favourite Fixes partially #225. --- src/modules/launcher/mod.rs | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/src/modules/launcher/mod.rs b/src/modules/launcher/mod.rs index 5fded46..dc9d077 100644 --- a/src/modules/launcher/mod.rs +++ b/src/modules/launcher/mod.rs @@ -165,6 +165,7 @@ impl Module for LauncherModule { match item { None => { let item: Item = handle.try_into()?; + items.insert(info.app_id.clone(), item.clone()); ItemOrWindow::Item(item) @@ -358,9 +359,10 @@ impl Module for LauncherModule { buttons.insert(item.app_id, button); } } - LauncherUpdate::AddWindow(app_id, _) => { + LauncherUpdate::AddWindow(app_id, win) => { if let Some(button) = buttons.get(&app_id) { button.set_open(true); + button.set_focused(win.open_state.is_focused()); let mut menu_state = write_lock!(button.menu_state); menu_state.num_windows += 1;