add feature flag for song notifications

enables users/distributions to ship without dbus dependency
This commit is contained in:
Henrik Friedrichsen
2020-09-07 23:50:45 +02:00
parent 69f11cdcf7
commit 3893a6f5a0
2 changed files with 6 additions and 2 deletions

View File

@@ -1,7 +1,9 @@
use std::cmp::Ordering;
use std::sync::{Arc, RwLock};
#[cfg(feature = "notify")]
use notify_rust::Notification;
use rand::prelude::*;
use strum_macros::Display;
@@ -221,6 +223,7 @@ impl Queue {
current.replace(index);
self.spotify.update_track();
if self.spotify.cfg.notify.unwrap_or(false) {
#[cfg(feature = "notify")]
if let Err(e) = Notification::new().summary(&track.to_string()).show() {
error!("error showing notification: {:?}", e);
}