diff --git a/src/config.rs b/src/config.rs index 54cf166..1e4a271 100644 --- a/src/config.rs +++ b/src/config.rs @@ -19,7 +19,7 @@ pub struct Config { pub backend_device: Option, pub volnorm: Option, pub volnorm_pregain: Option, - pub notify: Option + pub notify: Option, } #[derive(Serialize, Deserialize, Debug, Default, Clone)] diff --git a/src/main.rs b/src/main.rs index da2b097..402edde 100644 --- a/src/main.rs +++ b/src/main.rs @@ -224,10 +224,7 @@ fn main() { &cfg, )); - let queue = Arc::new(queue::Queue::new( - spotify.clone(), - cfg.notify.unwrap_or(false), - )); + let queue = Arc::new(queue::Queue::new(spotify.clone())); #[cfg(feature = "mpris")] let mpris_manager = Arc::new(mpris::MprisManager::new(spotify.clone(), queue.clone())); diff --git a/src/queue.rs b/src/queue.rs index 139237d..9dbeca8 100644 --- a/src/queue.rs +++ b/src/queue.rs @@ -20,19 +20,17 @@ pub struct Queue { random_order: RwLock>>, current_track: RwLock>, repeat: RwLock, - notify: bool, spotify: Arc, } impl Queue { - pub fn new(spotify: Arc, notify: bool) -> Queue { + pub fn new(spotify: Arc) -> Queue { let q = Queue { queue: Arc::new(RwLock::new(Vec::new())), spotify, current_track: RwLock::new(None), repeat: RwLock::new(RepeatSetting::None), random_order: RwLock::new(None), - notify, }; q.set_repeat(q.spotify.repeat); q.set_shuffle(q.spotify.shuffle); @@ -218,7 +216,7 @@ impl Queue { let mut current = self.current_track.write().unwrap(); current.replace(index); self.spotify.update_track(); - if self.notify { + if self.spotify.cfg.notify.unwrap_or(false) { Notification::new() .summary(&track.to_string()) .show() diff --git a/src/spotify.rs b/src/spotify.rs index 55c254d..0427d18 100644 --- a/src/spotify.rs +++ b/src/spotify.rs @@ -83,7 +83,7 @@ pub enum PlayerEvent { pub struct Spotify { events: EventManager, credentials: Credentials, - cfg: config::Config, + pub cfg: config::Config, status: RwLock, api: RwLock, elapsed: RwLock>,