blob: 66a0faf4bfd5e95ad29b7bd073cb20b585a40434 (
plain) (
blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
|
pub fn init() {
#[cfg(feature = "notifications")]
libnotify::init("mumd").unwrap(); //TODO handle panic (don't send 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(_) => {
log::debug!("Unable to send notification");
Some(false)
}
}
}
#[cfg(not(feature = "notifications"))]
pub fn send(_: String) -> Option<bool> {
None
}
|