commit
This commit is contained in:
parent
fddd48d98a
commit
8bbdc51523
@ -6,6 +6,7 @@ authors = ["candifloss <candifloss.cc>"]
|
||||
|
||||
[dependencies]
|
||||
zbus = "4.4.0"
|
||||
zvariant = "4.2.0"
|
||||
tokio = { version = "1.40.0", features = ["full"] }
|
||||
futures-util = "0.3.30"
|
||||
# rson_rs = "0.2.1"
|
16
src/main.rs
16
src/main.rs
@ -1,13 +1,21 @@
|
||||
use zbus::{Connection, Result, MessageStream};
|
||||
use futures_util::stream::TryStreamExt;
|
||||
use zbus::{Connection, MessageStream, Result};
|
||||
use zvariant::{Type, Value};
|
||||
|
||||
#[tokio::main]
|
||||
async fn main() -> Result<()> {
|
||||
let connection = Connection::session().await?;
|
||||
connection
|
||||
.request_name("org.freedesktop.Notifications") // Requesting dbus for this service name
|
||||
.request_name("org.freedesktop.Notifications") // Requesting dbus for this service name
|
||||
.await?;
|
||||
|
||||
//
|
||||
loop {}
|
||||
// Process incoming notifs
|
||||
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)]
|
||||
trait Notifications {
|
||||
/// CloseNotification method
|
||||
fn close_notification(&self, arg_0: u32) -> zbus::Result<()>;
|
||||
fn close_notification(&self, app_name: u32) -> zbus::Result<()>;
|
||||
|
||||
/// GetCapabilities method
|
||||
fn get_capabilities(&self) -> zbus::Result<Vec<String>>;
|
||||
@ -35,25 +35,25 @@ trait Notifications {
|
||||
#[allow(clippy::too_many_arguments)]
|
||||
fn notify(
|
||||
&self,
|
||||
arg_0: &str,
|
||||
arg_1: u32,
|
||||
arg_2: &str,
|
||||
arg_3: &str,
|
||||
arg_4: &str,
|
||||
arg_5: &[&str],
|
||||
arg_6: std::collections::HashMap<&str, &zbus::zvariant::Value<'_>>,
|
||||
arg_7: i32,
|
||||
app_name: &str,
|
||||
replace_id: u32,
|
||||
icon: &str,
|
||||
summary: &str,
|
||||
body: &str,
|
||||
actions: &[&str],
|
||||
hints: std::collections::HashMap<&str, &zbus::zvariant::Value<'_>>,
|
||||
expir_timeout: i32,
|
||||
) -> zbus::Result<u32>;
|
||||
|
||||
/// ActionInvoked 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
|
||||
#[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
|
||||
#[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