1
0
Fork 0
mirror of https://github.com/Zedfrigg/ironbar.git synced 2025-07-02 19:21:03 +02:00

feat(music): option to hide status icon on widget

Adds new `show_status_icon` option.

Resolves #97.
This commit is contained in:
Jake Stanger 2023-04-23 12:55:13 +01:00
parent dc16b1e15a
commit 76e2b7ba3e
No known key found for this signature in database
GPG key ID: C51FC8F9CB0BEA61
3 changed files with 13 additions and 3 deletions

View file

@ -88,6 +88,9 @@ pub struct MusicModule {
#[serde(default = "default_music_dir")]
pub(crate) music_dir: PathBuf,
#[serde(default = "crate::config::default_true")]
pub(crate) show_status_icon: bool,
#[serde(default = "default_icon_size")]
pub(crate) icon_size: i32,

View file

@ -192,21 +192,27 @@ impl Module<Button> for MusicModule {
if let Some(event) = event.take() {
label.set_label(&event.display_string);
button.show();
match event.status.state {
PlayerState::Playing => {
PlayerState::Playing if self.show_status_icon => {
icon_play.show();
icon_pause.hide();
}
PlayerState::Paused => {
PlayerState::Paused if self.show_status_icon => {
icon_pause.show();
icon_play.hide();
}
PlayerState::Stopped => {
button.hide();
}
_ => {}
}
button.show();
if !self.show_status_icon {
icon_pause.hide();
icon_play.hide();
}
} else {
button.hide();
try_send!(tx, ModuleUpdateEvent::ClosePopup);