-
-
Notifications
You must be signed in to change notification settings - Fork 2
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
af9b7c1
commit e952fd4
Showing
2 changed files
with
59 additions
and
3 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,22 @@ | ||
use futures::channel::mpsc::Sender; | ||
|
||
use crate::Message; | ||
use zbus::{connection, interface}; | ||
pub struct LalaBarBackend { | ||
sender: Sender<Message>, | ||
} | ||
|
||
#[interface(name = "org.lalabar.Backend")] | ||
impl LalaBarBackend { | ||
fn toggle_bar(&mut self) { | ||
self.sender.try_send(Message::ToggleLauncherDBus).ok(); | ||
} | ||
} | ||
|
||
pub async fn start_backend(sender: Sender<Message>) -> Result<zbus::Connection, zbus::Error> { | ||
connection::Builder::session()? | ||
.name("org.lalabar.backend")? | ||
.serve_at("/org/lalabar/Backend", LalaBarBackend { sender })? | ||
.build() | ||
.await | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters