From a3def74076ec5af717c648d2d59993b7e7cdf95b Mon Sep 17 00:00:00 2001 From: szymon Date: Wed, 30 Sep 2026 14:07:51 +0200 Subject: [PATCH] feat: implement set_timeout --- src/notification.rs | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) diff --git a/src/notification.rs b/src/notification.rs index 19162b6..f5cf92d 100644 --- a/src/notification.rs +++ b/src/notification.rs @@ -31,6 +31,7 @@ pub enum HintValue { Boolean(bool), } +/// The timeout in milliseconds pub enum Timeout { Default, Never, @@ -226,7 +227,13 @@ impl<'a> Notification { /// /// Note that the timeout may be ignored by the server. pub fn set_timeout(&mut self, timeout: Timeout) { - todo!(); + let timeout_c = match timeout { + Timeout::Default => NOTIFY_EXPIRES_DEFAULT as i32, + Timeout::Never => NOTIFY_EXPIRES_NEVER as i32, + Timeout::Custom(i) => i, + }; + + unsafe { notify_notification_set_timeout(self.inner, timeout_c) } } /// Sets the urgency level of this notification