aboutsummaryrefslogtreecommitdiffstats
path: root/mumd/src/notify.rs
diff options
context:
space:
mode:
authorGustav Sörnäs <gustav@sornas.net>2020-10-29 21:27:48 +0100
committerGustav Sörnäs <gustav@sornas.net>2020-10-29 21:27:48 +0100
commit3e7e375e65760a03b6692106ab0ed806ca65e470 (patch)
treeca30f277a9a81e2920c2637a7ca824ec711c8b6e /mumd/src/notify.rs
parent7120ef134c952781ab6a6d23b6be390f915372f5 (diff)
parent69ec88d3fc2e3762cf596bbf0226b204ba35d874 (diff)
downloadmum-3e7e375e65760a03b6692106ab0ed806ca65e470.tar.gz
Merge branch 'libnotify' into main
Diffstat (limited to 'mumd/src/notify.rs')
-rw-r--r--mumd/src/notify.rs19
1 files changed, 19 insertions, 0 deletions
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
+ }
+ }
+}