From 69ec88d3fc2e3762cf596bbf0226b204ba35d874 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Gustav=20S=C3=B6rn=C3=A4s?= Date: Thu, 29 Oct 2020 15:04:12 +0100 Subject: add file --- mumd/src/notify.rs | 19 +++++++++++++++++++ 1 file changed, 19 insertions(+) create mode 100644 mumd/src/notify.rs diff --git a/mumd/src/notify.rs b/mumd/src/notify.rs new file mode 100644 index 0000000..5bb1a26 --- /dev/null +++ b/mumd/src/notify.rs @@ -0,0 +1,19 @@ +use log::*; + +pub fn init() { + libnotify::init("mumd").unwrap(); +} + +pub fn send(msg: String) -> bool { + match libnotify::Notification::new( + "mumd", + Some(msg.as_str()), + None, + ).show() { + Ok(_) => { true } + Err(_) => { + debug!("Unable to send notification"); + false + } + } +} -- cgit v1.2.1