commit
This commit is contained in:
parent
fddd48d98a
commit
8bbdc51523
@ -6,6 +6,7 @@ authors = ["candifloss <candifloss.cc>"]
|
|||||||
|
|
||||||
[dependencies]
|
[dependencies]
|
||||||
zbus = "4.4.0"
|
zbus = "4.4.0"
|
||||||
|
zvariant = "4.2.0"
|
||||||
tokio = { version = "1.40.0", features = ["full"] }
|
tokio = { version = "1.40.0", features = ["full"] }
|
||||||
futures-util = "0.3.30"
|
futures-util = "0.3.30"
|
||||||
# rson_rs = "0.2.1"
|
# rson_rs = "0.2.1"
|
18
src/main.rs
18
src/main.rs
@ -1,13 +1,21 @@
|
|||||||
use zbus::{Connection, Result, MessageStream};
|
|
||||||
use futures_util::stream::TryStreamExt;
|
use futures_util::stream::TryStreamExt;
|
||||||
|
use zbus::{Connection, MessageStream, Result};
|
||||||
|
use zvariant::{Type, Value};
|
||||||
|
|
||||||
#[tokio::main]
|
#[tokio::main]
|
||||||
async fn main() -> Result<()> {
|
async fn main() -> Result<()> {
|
||||||
let connection = Connection::session().await?;
|
let connection = Connection::session().await?;
|
||||||
connection
|
connection
|
||||||
.request_name("org.freedesktop.Notifications") // Requesting dbus for this service name
|
.request_name("org.freedesktop.Notifications") // Requesting dbus for this service name
|
||||||
.await?;
|
.await?;
|
||||||
|
|
||||||
//
|
// Process incoming notifs
|
||||||
loop {}
|
use futures_util::stream::TryStreamExt;
|
||||||
}
|
|
||||||
|
let mut stream = zbus::MessageStream::from(&connection); // Convert the connection into a message stream
|
||||||
|
while let Some(msg) = stream.try_next().await? {
|
||||||
|
///
|
||||||
|
}
|
||||||
|
|
||||||
|
Ok(())
|
||||||
|
}
|
||||||
|
@ -23,7 +23,7 @@ use zbus::proxy;
|
|||||||
#[proxy(interface = "org.freedesktop.Notifications", assume_defaults = true)]
|
#[proxy(interface = "org.freedesktop.Notifications", assume_defaults = true)]
|
||||||
trait Notifications {
|
trait Notifications {
|
||||||
/// CloseNotification method
|
/// CloseNotification method
|
||||||
fn close_notification(&self, arg_0: u32) -> zbus::Result<()>;
|
fn close_notification(&self, app_name: u32) -> zbus::Result<()>;
|
||||||
|
|
||||||
/// GetCapabilities method
|
/// GetCapabilities method
|
||||||
fn get_capabilities(&self) -> zbus::Result<Vec<String>>;
|
fn get_capabilities(&self) -> zbus::Result<Vec<String>>;
|
||||||
@ -35,25 +35,25 @@ trait Notifications {
|
|||||||
#[allow(clippy::too_many_arguments)]
|
#[allow(clippy::too_many_arguments)]
|
||||||
fn notify(
|
fn notify(
|
||||||
&self,
|
&self,
|
||||||
arg_0: &str,
|
app_name: &str,
|
||||||
arg_1: u32,
|
replace_id: u32,
|
||||||
arg_2: &str,
|
icon: &str,
|
||||||
arg_3: &str,
|
summary: &str,
|
||||||
arg_4: &str,
|
body: &str,
|
||||||
arg_5: &[&str],
|
actions: &[&str],
|
||||||
arg_6: std::collections::HashMap<&str, &zbus::zvariant::Value<'_>>,
|
hints: std::collections::HashMap<&str, &zbus::zvariant::Value<'_>>,
|
||||||
arg_7: i32,
|
expir_timeout: i32,
|
||||||
) -> zbus::Result<u32>;
|
) -> zbus::Result<u32>;
|
||||||
|
|
||||||
/// ActionInvoked signal
|
/// ActionInvoked signal
|
||||||
#[zbus(signal)]
|
#[zbus(signal)]
|
||||||
fn action_invoked(&self, arg_0: u32, arg_1: &str) -> zbus::Result<()>;
|
fn action_invoked(&self, app_name: u32, replace_id: &str) -> zbus::Result<()>;
|
||||||
|
|
||||||
/// ActivationToken signal
|
/// ActivationToken signal
|
||||||
#[zbus(signal)]
|
#[zbus(signal)]
|
||||||
fn activation_token(&self, arg_0: u32, arg_1: &str) -> zbus::Result<()>;
|
fn activation_token(&self, app_name: u32, replace_id: &str) -> zbus::Result<()>;
|
||||||
|
|
||||||
/// NotificationClosed signal
|
/// NotificationClosed signal
|
||||||
#[zbus(signal)]
|
#[zbus(signal)]
|
||||||
fn notification_closed(&self, arg_0: u32, arg_1: u32) -> zbus::Result<()>;
|
fn notification_closed(&self, app_name: u32, replace_id: u32) -> zbus::Result<()>;
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user