pub fn init() {
#[cfg(feature = "notifications")]
if let Err(e) = libnotify::init("mumd") {
log::warn!("Unable to initialize notifications: {}", e);
}
}
#[cfg(feature = "notifications")]
pub fn send(msg: String) -> Option<std::thread::JoinHandle<bool>> {
Some(std::thread::spawn(move || {
let status = libnotify::Notification::new("mumd", Some(msg.as_str()), None).show();
if let Err(e) = &status {
log::warn!("Unable to send notification: {}", e);
}
status.is_ok()
}))
}
#[cfg(not(feature = "notifications"))]
pub fn send(_: String) -> Option<std::thread::JoinHandle<bool>> {
None
}