git.lucas.co / cce-system-interface
system settings
git clone https://git.lucas.co/cce-system-interface.git

commit8ee172f7f308187adc5ca9f1d6242a90a2233354
parent8d107a8b49
authorLucas Galante <[email protected]>
date2026-06-19 16:32
Fix send test notification button by using async zbus D-Bus call

 src/pages/services.rs | 22 ++++++++++++++++++++--
 1 file changed, 20 insertions(+), 2 deletions(-)

diff --git a/src/pages/services.rs b/src/pages/services.rs
index d8f4af3..ad6989b 100644
--- a/src/pages/services.rs
+++ b/src/pages/services.rs
@@ -550,7 +550,26 @@ pub fn update(state: &mut ServicesState, msg: ServicesMessage) {
             write_config_value("duration", &state.notifications_duration.to_string());
         }
         ServicesMessage::SendTestNotification => {
-            send_ipc_command("notify \"cce-client\" \"System notifications are working correctly!\"");
+            tokio::spawn(async move {
+                if let Ok(connection) = zbus::Connection::session().await {
+                    let _ = connection.call_method(
+                        Some("org.freedesktop.Notifications"),
+                        "/org/freedesktop/Notifications",
+                        Some("org.freedesktop.Notifications"),
+                        "Notify",
+                        &(
+                            "cce-client",
+                            0u32,
+                            "",
+                            "System notifications are working correctly!",
+                            "",
+                            Vec::<&str>::new(),
+                            std::collections::HashMap::<&str, zbus::zvariant::Value>::new(),
+                            -1i32,
+                        )
+                    ).await;
+                }
+            });
         }
         ServicesMessage::NotificationsRefreshed(new) => {
             state.notifications_loaded = true;
@@ -873,4 +892,3 @@ mod tests {
         let _ = fs::remove_file(path);
     }
 }
-