From a37be90e811f365273bf632bf7090b63a368f092 Mon Sep 17 00:00:00 2001 From: Michael Aaron Murphy Date: Mon, 9 Feb 2026 22:04:13 +0100 Subject: [PATCH] fix(single-instance): unminimize main window on dbus activate --- src/app/cosmic.rs | 29 +++++++++++++++++++++-------- 1 file changed, 21 insertions(+), 8 deletions(-) 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; } }