Load Magpie client in notifications
This commit is contained in:
parent
ce187a0381
commit
72d7e703c1
|
@ -4,5 +4,6 @@ version = "0.1.0"
|
||||||
edition = "2021"
|
edition = "2021"
|
||||||
|
|
||||||
[dependencies]
|
[dependencies]
|
||||||
|
canary-magpie = { path = "../magpie" }
|
||||||
smol = "1.2"
|
smol = "1.2"
|
||||||
zbus = "3.5"
|
zbus = "3.5"
|
||||||
|
|
|
@ -1,9 +1,15 @@
|
||||||
use std::collections::HashMap;
|
use std::collections::HashMap;
|
||||||
use std::future::pending;
|
use std::future::pending;
|
||||||
|
|
||||||
|
use canary_magpie::protocol::*;
|
||||||
|
use smol::net::unix::UnixStream;
|
||||||
use zbus::{dbus_interface, zvariant::Value, ConnectionBuilder, SignalContext};
|
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")]
|
#[dbus_interface(name = "org.freedesktop.Notifications")]
|
||||||
impl Notifications {
|
impl Notifications {
|
||||||
|
@ -55,7 +61,10 @@ impl Notifications {
|
||||||
|
|
||||||
pub fn main() {
|
pub fn main() {
|
||||||
smol::block_on(async {
|
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()
|
let _ = ConnectionBuilder::session()
|
||||||
.unwrap()
|
.unwrap()
|
||||||
|
|
Loading…
Reference in New Issue