diff --git a/src/app/cosmic.rs b/src/app/cosmic.rs index 803a56b..bfda4a1 100644 --- a/src/app/cosmic.rs +++ b/src/app/cosmic.rs @@ -1034,15 +1034,28 @@ impl Cosmic { } return Task::batch(cmds); } - Action::Activate(_token) => - { - #[cfg(feature = "wayland")] + Action::Activate(_token) => { if let Some(id) = self.app.core().main_window_id() { - return iced_winit::platform_specific::commands::activation::activate( - id, - #[allow(clippy::used_underscore_binding)] - _token, - ); + // Unminimize window before requesting to activate it. + let mut task = iced_runtime::window::minimize(id, false); + + #[cfg(feature = "wayland")] + { + task = task.chain( + iced_winit::platform_specific::commands::activation::activate( + id, + #[allow(clippy::used_underscore_binding)] + _token, + ), + ) + } + + #[cfg(not(feature = "wayland"))] + { + task = task.chain(iced_runtime::window::gain_focus(id)); + } + + return task; } }