diff --git a/Cargo.toml b/Cargo.toml index 619eb01..c2534e1 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -28,7 +28,7 @@ librespot-core = "0.1.3" librespot-playback = "0.1.3" librespot-protocol = "0.1.3" log = "0.4.0" -notify-rust = "4" +notify-rust = { version = "4", optional = true } rspotify = { version = "0.10.0", features = ["blocking"] } serde = "1.0" serde_json = "1.0" @@ -57,4 +57,5 @@ rodio_backend = ["librespot-playback/rodio-backend"] portaudio_backend = ["librespot-playback/portaudio-backend"] termion_backend = ["cursive/termion-backend"] mpris = ["dbus"] -default = ["share_clipboard", "pulseaudio_backend", "mpris", "cursive/pancurses-backend"] +notify = ["notify-rust"] +default = ["share_clipboard", "pulseaudio_backend", "mpris", "notify", "cursive/pancurses-backend"] diff --git a/src/queue.rs b/src/queue.rs index f929bf6..9fa17b7 100644 --- a/src/queue.rs +++ b/src/queue.rs @@ -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); }