feat: add dbus_connection() method to app::Application trait
This commit is contained in:
parent
38dde24f96
commit
b8eaad2a7e
4 changed files with 21 additions and 0 deletions
|
|
@ -22,6 +22,8 @@ pub enum Action {
|
||||||
Close,
|
Close,
|
||||||
/// Closes or shows the context drawer.
|
/// Closes or shows the context drawer.
|
||||||
ContextDrawer(bool),
|
ContextDrawer(bool),
|
||||||
|
#[cfg(feature = "single-instance")]
|
||||||
|
DbusConnection(zbus::Connection),
|
||||||
/// Requests to drag the window.
|
/// Requests to drag the window.
|
||||||
Drag,
|
Drag,
|
||||||
/// Window focus changed
|
/// Window focus changed
|
||||||
|
|
|
||||||
|
|
@ -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")]
|
#[cfg(feature = "xdg-portal")]
|
||||||
Action::DesktopSettings(crate::theme::portal::Desktop::ColorScheme(s)) => {
|
Action::DesktopSettings(crate::theme::portal::Desktop::ColorScheme(s)) => {
|
||||||
use ashpd::desktop::settings::ColorScheme;
|
use ashpd::desktop::settings::ColorScheme;
|
||||||
|
|
|
||||||
|
|
@ -437,6 +437,14 @@ where
|
||||||
fn dbus_activation(&mut self, msg: crate::dbus_activation::Message) -> Task<Self::Message> {
|
fn dbus_activation(&mut self, msg: crate::dbus_activation::Message) -> Task<Self::Message> {
|
||||||
Task::none()
|
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`].
|
/// Methods automatically derived for all types implementing [`Application`].
|
||||||
|
|
|
||||||
|
|
@ -44,6 +44,12 @@ pub fn subscription<App: ApplicationExt>() -> Subscription<crate::Action<App::Me
|
||||||
std::process::exit(1);
|
std::process::exit(1);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
output
|
||||||
|
.send(crate::Action::Cosmic(crate::app::Action::DbusConnection(
|
||||||
|
conn.clone(),
|
||||||
|
)))
|
||||||
|
.await;
|
||||||
|
|
||||||
#[cfg(feature = "smol")]
|
#[cfg(feature = "smol")]
|
||||||
let handle = {
|
let handle = {
|
||||||
std::thread::spawn(move || {
|
std::thread::spawn(move || {
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue