File tree Expand file tree Collapse file tree 4 files changed +21
-0
lines changed Expand file tree Collapse file tree 4 files changed +21
-0
lines changed Original file line number Diff line number Diff line change @@ -22,6 +22,8 @@ pub enum Action {
2222 Close ,
2323 /// Closes or shows the context drawer.
2424 ContextDrawer ( bool ) ,
25+ #[ cfg( feature = "single-instance" ) ]
26+ DbusConnection ( zbus:: Connection ) ,
2527 /// Requests to drag the window.
2628 Drag ,
2729 /// Window focus changed
Original file line number Diff line number Diff line change @@ -761,6 +761,11 @@ impl<T: Application> Cosmic<T> {
761761 }
762762 }
763763
764+ #[ cfg( feature = "single-instance" ) ]
765+ Action :: DbusConnection ( conn) => {
766+ return self . app . dbus_connection ( conn) ;
767+ }
768+
764769 #[ cfg( feature = "xdg-portal" ) ]
765770 Action :: DesktopSettings ( crate :: theme:: portal:: Desktop :: ColorScheme ( s) ) => {
766771 use ashpd:: desktop:: settings:: ColorScheme ;
Original file line number Diff line number Diff line change @@ -437,6 +437,14 @@ where
437437 fn dbus_activation ( & mut self , msg : crate :: dbus_activation:: Message ) -> Task < Self :: Message > {
438438 Task :: none ( )
439439 }
440+
441+ /// Invoked on connect to dbus session socket used for dbus activation
442+ ///
443+ /// Can be used to expose custom interfaces on the same owned name.
444+ #[ cfg( feature = "single-instance" ) ]
445+ fn dbus_connection ( & mut self , conn : zbus:: Connection ) -> Task < Self :: Message > {
446+ Task :: none ( )
447+ }
440448}
441449
442450/// Methods automatically derived for all types implementing [`Application`].
Original file line number Diff line number Diff line change @@ -44,6 +44,12 @@ pub fn subscription<App: ApplicationExt>() -> Subscription<crate::Action<App::Me
4444 std:: process:: exit ( 1 ) ;
4545 }
4646
47+ output
48+ . send ( crate :: Action :: Cosmic ( crate :: app:: Action :: DbusConnection (
49+ conn. clone ( ) ,
50+ ) ) )
51+ . await ;
52+
4753 #[ cfg( feature = "smol" ) ]
4854 let handle = {
4955 std:: thread:: spawn ( move || {
You can’t perform that action at this time.
0 commit comments