mirror of
https://github.com/Zedfrigg/ironbar.git
synced 2025-07-01 18:51:04 +02:00
feat(music): option to hide status icon on widget
Adds new `show_status_icon` option. Resolves #97.
This commit is contained in:
parent
dc16b1e15a
commit
76e2b7ba3e
3 changed files with 13 additions and 3 deletions
|
@ -27,6 +27,7 @@ in MPRIS mode, the widget will listen to all players and automatically detect/di
|
||||||
| `icons.track` | `string/image` | `` | Icon to show next to track title. |
|
| `icons.track` | `string/image` | `` | Icon to show next to track title. |
|
||||||
| `icons.album` | `string/image` | `` | Icon to show next to album name. |
|
| `icons.album` | `string/image` | `` | Icon to show next to album name. |
|
||||||
| `icons.artist` | `string/image` | `ﴁ` | Icon to show next to artist name. |
|
| `icons.artist` | `string/image` | `ﴁ` | Icon to show next to artist name. |
|
||||||
|
| `show_status_icon` | `boolean` | `true` | Whether to show the play/pause icon on the widget. |
|
||||||
| `icon_size` | `integer` | `32` | Size to render icon at (image icons only). |
|
| `icon_size` | `integer` | `32` | Size to render icon at (image icons only). |
|
||||||
| `cover_image_size` | `integer` | `128` | Size to render album art image at inside popup. |
|
| `cover_image_size` | `integer` | `128` | Size to render album art image at inside popup. |
|
||||||
| `host` | `string/image` | `localhost:6600` | [MPD Only] TCP or Unix socket for the MPD server. |
|
| `host` | `string/image` | `localhost:6600` | [MPD Only] TCP or Unix socket for the MPD server. |
|
||||||
|
|
|
@ -88,6 +88,9 @@ pub struct MusicModule {
|
||||||
#[serde(default = "default_music_dir")]
|
#[serde(default = "default_music_dir")]
|
||||||
pub(crate) music_dir: PathBuf,
|
pub(crate) music_dir: PathBuf,
|
||||||
|
|
||||||
|
#[serde(default = "crate::config::default_true")]
|
||||||
|
pub(crate) show_status_icon: bool,
|
||||||
|
|
||||||
#[serde(default = "default_icon_size")]
|
#[serde(default = "default_icon_size")]
|
||||||
pub(crate) icon_size: i32,
|
pub(crate) icon_size: i32,
|
||||||
|
|
||||||
|
|
|
@ -192,21 +192,27 @@ impl Module<Button> for MusicModule {
|
||||||
if let Some(event) = event.take() {
|
if let Some(event) = event.take() {
|
||||||
label.set_label(&event.display_string);
|
label.set_label(&event.display_string);
|
||||||
|
|
||||||
|
button.show();
|
||||||
|
|
||||||
match event.status.state {
|
match event.status.state {
|
||||||
PlayerState::Playing => {
|
PlayerState::Playing if self.show_status_icon => {
|
||||||
icon_play.show();
|
icon_play.show();
|
||||||
icon_pause.hide();
|
icon_pause.hide();
|
||||||
}
|
}
|
||||||
PlayerState::Paused => {
|
PlayerState::Paused if self.show_status_icon => {
|
||||||
icon_pause.show();
|
icon_pause.show();
|
||||||
icon_play.hide();
|
icon_play.hide();
|
||||||
}
|
}
|
||||||
PlayerState::Stopped => {
|
PlayerState::Stopped => {
|
||||||
button.hide();
|
button.hide();
|
||||||
}
|
}
|
||||||
|
_ => {}
|
||||||
}
|
}
|
||||||
|
|
||||||
button.show();
|
if !self.show_status_icon {
|
||||||
|
icon_pause.hide();
|
||||||
|
icon_play.hide();
|
||||||
|
}
|
||||||
} else {
|
} else {
|
||||||
button.hide();
|
button.hide();
|
||||||
try_send!(tx, ModuleUpdateEvent::ClosePopup);
|
try_send!(tx, ModuleUpdateEvent::ClosePopup);
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue