diff --git a/shell/ferese-shell/src/main.rs b/shell/ferese-shell/src/main.rs index a4815a4..c9b781d 100644 --- a/shell/ferese-shell/src/main.rs +++ b/shell/ferese-shell/src/main.rs @@ -171,6 +171,7 @@ struct FereseShell { theme_error: Option, pending_config_error: Option, menu: Option, + closing_menu_effects: std::collections::HashMap, system_modal: Option, launcher: Option, launcher_files: launcher::files::Files, @@ -340,6 +341,7 @@ impl cosmic::Application for FereseShell { theme_error: None, pending_config_error, menu: None, + closing_menu_effects: Default::default(), system_modal: None, launcher: None, launcher_files: Default::default(), @@ -1204,6 +1206,7 @@ mod tests { theme_error: None, pending_config_error: None, menu: None, + closing_menu_effects: Default::default(), system_modal: None, launcher: None, launcher_files: Default::default(), diff --git a/shell/ferese-shell/src/status_ui/lifecycle.rs b/shell/ferese-shell/src/status_ui/lifecycle.rs index 9433954..74e5f64 100644 --- a/shell/ferese-shell/src/status_ui/lifecycle.rs +++ b/shell/ferese-shell/src/status_ui/lifecycle.rs @@ -152,9 +152,13 @@ impl FereseShell { self.night_light_temperature = None; let tooltip = self.dismiss_workspace_tooltip(); crate::EFFECT_FRAME_PENDING.store(false, std::sync::atomic::Ordering::Relaxed); - let Some(menu) = self.menu.take() else { + let Some(mut menu) = self.menu.take() else { return tooltip; }; + // Keep opacity applied until Iced has destroyed the popup's Wayland surface. + if let Some(effects) = menu.effects.take() { + self.closing_menu_effects.insert(menu.id, effects); + } self.refresh_media_art(false); if menu.kind == Menu::Notifications { self.notifications.history_open = false; diff --git a/shell/ferese-shell/src/surfaces.rs b/shell/ferese-shell/src/surfaces.rs index 580d1be..03af00b 100644 --- a/shell/ferese-shell/src/surfaces.rs +++ b/shell/ferese-shell/src/surfaces.rs @@ -416,6 +416,9 @@ impl FereseShell { .. }) if self.menu.is_some() => self.close_menu(), Event::PlatformSpecific(PlatformSpecific::Wayland(wayland::Event::Popup(event, surface, popup_id))) => { + if matches!(event, wayland::PopupEvent::Done) { + self.closing_menu_effects.remove(&popup_id); + } if self.workspace_ui.tooltip == Some(popup_id) && matches!(event, wayland::PopupEvent::Done) { self.workspace_ui.tooltip = None; return self.dismiss_workspace_tooltip(); @@ -455,7 +458,10 @@ impl FereseShell { { self.close_system_modal() } - Event::Window(window::Event::Closed) => Task::none(), + Event::Window(window::Event::Closed) => { + self.closing_menu_effects.remove(&id); + Task::none() + }, Event::PlatformSpecific(PlatformSpecific::Wayland(wayland::Event::Frame(_, surface, frame_id))) if self.menu.as_ref().is_some_and(|menu| menu.id == frame_id) => {