diff --git a/src/modules/mpd/client.rs b/src/modules/mpd/client.rs index fcf33b7..08a8c8d 100644 --- a/src/modules/mpd/client.rs +++ b/src/modules/mpd/client.rs @@ -59,7 +59,7 @@ impl MpdClient { while let Some(change) = state_changes.next().await { debug!("Received state change: {:?}", change); - if let ConnectionEvent::SubsystemChange(Subsystem::Player | Subsystem::Queue) = + if let ConnectionEvent::SubsystemChange(Subsystem::Player | Subsystem::Queue | Subsystem::Mixer) = change { tx2.send(())?; diff --git a/src/modules/mpd/mod.rs b/src/modules/mpd/mod.rs index 0b3c6a8..d92ba30 100644 --- a/src/modules/mpd/mod.rs +++ b/src/modules/mpd/mod.rs @@ -9,7 +9,7 @@ use dirs::{audio_dir, home_dir}; use glib::Continue; use gtk::gdk_pixbuf::Pixbuf; use gtk::prelude::*; -use gtk::{Button, Image, Label, Orientation}; +use gtk::{Button, Image, Label, Orientation, Scale}; use mpd_client::commands; use mpd_client::responses::{PlayState, Song, Status}; use mpd_client::tag::Tag; @@ -26,16 +26,20 @@ pub enum PlayerCommand { Previous, Toggle, Next, + Volume(u8), } #[derive(Debug, Deserialize, Clone)] pub struct Icons { /// Icon to display when playing. #[serde(default = "default_icon_play")] - play: Option, + play: String, /// Icon to display when paused. #[serde(default = "default_icon_pause")] - pause: Option, + pause: String, + /// Icon to display under volume slider + #[serde(default = "default_icon_volume")] + volume: String, } impl Default for Icons { @@ -43,6 +47,7 @@ impl Default for Icons { Self { pause: default_icon_pause(), play: default_icon_play(), + volume: default_icon_volume(), } } } @@ -73,14 +78,16 @@ fn default_format() -> String { String::from("{icon} {title} / {artist}") } -#[allow(clippy::unnecessary_wraps)] -fn default_icon_play() -> Option { - Some(String::from("")) +fn default_icon_play() -> String { + String::from("") } -#[allow(clippy::unnecessary_wraps)] -fn default_icon_pause() -> Option { - Some(String::from("")) +fn default_icon_pause() -> String { + String::from("") +} + +fn default_icon_volume() -> String { + String::from("墳") } fn default_music_dir() -> PathBuf { @@ -186,6 +193,7 @@ impl Module