diff options
| author | Gustav Sörnäs <gustav@sornas.net> | 2020-11-06 15:21:54 +0100 |
|---|---|---|
| committer | Gustav Sörnäs <gustav@sornas.net> | 2020-11-06 15:21:54 +0100 |
| commit | bd01bda3ad20760800b3b2338ff14f647a38b949 (patch) | |
| tree | 00b1f37634a3b433df43333ec47fcc95dd6bdbb1 /mumd/src | |
| parent | d6496cb0f6abba855b04338fa8bc5aaa89487c29 (diff) | |
| download | mum-bd01bda3ad20760800b3b2338ff14f647a38b949.tar.gz | |
add feature libnotify to mumd
Diffstat (limited to 'mumd/src')
| -rw-r--r-- | mumd/src/notify.rs | 17 |
1 files changed, 11 insertions, 6 deletions
diff --git a/mumd/src/notify.rs b/mumd/src/notify.rs index 82ec6b6..7d08714 100644 --- a/mumd/src/notify.rs +++ b/mumd/src/notify.rs @@ -1,15 +1,20 @@ -use log::*; - pub fn init() { + #[cfg(feature = "libnotify")] libnotify::init("mumd").unwrap(); } -pub fn send(msg: String) -> bool { +#[cfg(feature = "libnotify")] +pub fn send(msg: String) -> Option<bool> { match libnotify::Notification::new("mumd", Some(msg.as_str()), None).show() { - Ok(_) => true, + Ok(_) => Some(true), Err(_) => { - debug!("Unable to send notification"); - false + log::debug!("Unable to send notification"); + Some(false) } } } + +#[cfg(not(feature = "libnotify"))] +pub fn send(_msg: String) -> Option<bool> { + None +} |
