Load Magpie client in notifications

This commit is contained in:
mars 2022-11-29 21:56:59 -07:00
parent ce187a0381
commit 72d7e703c1
2 changed files with 12 additions and 2 deletions

View File

@ -4,5 +4,6 @@ version = "0.1.0"
edition = "2021"
[dependencies]
canary-magpie = { path = "../magpie" }
smol = "1.2"
zbus = "3.5"

View File

@ -1,9 +1,15 @@
use std::collections::HashMap;
use std::future::pending;
use canary_magpie::protocol::*;
use smol::net::unix::UnixStream;
use zbus::{dbus_interface, zvariant::Value, ConnectionBuilder, SignalContext};
pub struct Notifications {}
pub type MagpieClient = ClientMessenger<UnixStream>;
pub struct Notifications {
magpie: MagpieClient,
}
#[dbus_interface(name = "org.freedesktop.Notifications")]
impl Notifications {
@ -55,7 +61,10 @@ impl Notifications {
pub fn main() {
smol::block_on(async {
let notifications = Notifications {};
let sock_path = find_socket();
let socket = UnixStream::connect(sock_path).await.unwrap();
let magpie = MagpieClient::new(socket);
let notifications = Notifications { magpie };
let _ = ConnectionBuilder::session()
.unwrap()