feat: add dbus_connection() method to app::Application trait

This commit is contained in:
Ian Douglas Scott 2025-07-21 13:59:09 -07:00 committed by GitHub
parent 38dde24f96
commit b8eaad2a7e
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
4 changed files with 21 additions and 0 deletions

View file

@ -22,6 +22,8 @@ pub enum Action {
Close,
/// Closes or shows the context drawer.
ContextDrawer(bool),
#[cfg(feature = "single-instance")]
DbusConnection(zbus::Connection),
/// Requests to drag the window.
Drag,
/// Window focus changed

View file

@ -761,6 +761,11 @@ impl<T: Application> Cosmic<T> {
}
}
#[cfg(feature = "single-instance")]
Action::DbusConnection(conn) => {
return self.app.dbus_connection(conn);
}
#[cfg(feature = "xdg-portal")]
Action::DesktopSettings(crate::theme::portal::Desktop::ColorScheme(s)) => {
use ashpd::desktop::settings::ColorScheme;

View file

@ -437,6 +437,14 @@ where
fn dbus_activation(&mut self, msg: crate::dbus_activation::Message) -> Task<Self::Message> {
Task::none()
}
/// Invoked on connect to dbus session socket used for dbus activation
///
/// Can be used to expose custom interfaces on the same owned name.
#[cfg(feature = "single-instance")]
fn dbus_connection(&mut self, conn: zbus::Connection) -> Task<Self::Message> {
Task::none()
}
}
/// Methods automatically derived for all types implementing [`Application`].