diff --git a/cosmic-applet-power/src/main.rs b/cosmic-applet-power/src/main.rs index 12742822..44f280b4 100644 --- a/cosmic-applet-power/src/main.rs +++ b/cosmic-applet-power/src/main.rs @@ -72,6 +72,7 @@ enum Message { Confirm, Cancel, Zbus(Result<(), zbus::Error>), + Closed(window::Id), } impl cosmic::Application for Power { @@ -211,6 +212,12 @@ impl cosmic::Application for Power { } Command::none() } + Message::Closed(id) => { + if self.popup == Some(id) { + self.popup = None; + } + Command::none() + } } } @@ -330,6 +337,10 @@ impl cosmic::Application for Power { widget::text("").into() } } + + fn on_close_requested(&self, id: window::Id) -> Option { + Some(Message::Closed(id)) + } } // ### UI Helplers