wip: dbus activation & single instance support

refactor: activation action with new trait for subcommand and args

refactor: libcosmic can handle sending the activation request

cleanup
This commit is contained in:
Ashley Wulber 2023-11-13 16:28:48 -05:00 committed by Ashley Wulber
parent 1caae11e8f
commit c9554a8740
5 changed files with 373 additions and 3 deletions

View file

@ -55,6 +55,8 @@ pub enum Message {
/// Capabilities the window manager supports
#[cfg(feature = "wayland")]
WmCapabilities(window::Id, WindowManagerCapabilities),
/// Activate the application
Activate(String),
}
#[derive(Default)]
@ -177,6 +179,12 @@ where
})
.map(super::Message::Cosmic),
window_events.map(super::Message::Cosmic),
#[cfg(feature = "zbus")]
self.app
.core()
.single_instance
.then(|| super::single_instance_subscription::<T>())
.unwrap_or_else(Subscription::none),
])
}
@ -356,6 +364,13 @@ impl<T: Application> Cosmic<T> {
});
}
}
Message::Activate(token) => {
#[cfg(feature = "wayland")]
return iced_sctk::commands::activation::activate(
iced::window::Id::default(),
token,
);
}
}
iced::Command::none()