blob: e52b9090523cca60c808ec075a0b3921c5c7e2ff (
plain) (
blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
|
use log::*;
pub fn init() {
#[cfg(feature = "notifications")]
if libnotify::init("mumd").is_err() {
warn!("Unable to initialize notifications");
}
}
#[cfg(feature = "notifications")]
pub fn send(msg: String) -> Option<bool> {
match libnotify::Notification::new("mumd", Some(msg.as_str()), None).show() {
Ok(_) => Some(true),
Err(_) => {
warn!("Unable to send notification");
Some(false)
}
}
}
#[cfg(not(feature = "notifications"))]
pub fn send(_: String) -> Option<bool> {
None
}
|