Add 'muted' property to JSON output

This commit is contained in:
Erwin Boskma 2023-07-03 16:01:31 +02:00
parent 60192e44fa
commit 888ea9758b
Signed by: erwin
SSH key fingerprint: SHA256:9LmFDe1C6jSrEyqxxvX8NtJBmcbB105XoqyUZF092bg
2 changed files with 9 additions and 0 deletions

View file

@ -427,6 +427,7 @@ impl HomeAssistant {
OutputFormat::Waybar => Waybar::builder()
.text(text)
.percentage((volume_raw * 100.) as u8)
.muted(is_muted)
.build()
.to_string(),
OutputFormat::I3Blocks => I3Blocks::builder().text(text).build().to_string(),

View file

@ -11,6 +11,7 @@ pub(crate) struct WaybarBuilder {
tooltip: String,
class: String,
percentage: u8,
muted: bool,
}
impl WaybarBuilder {
@ -43,6 +44,11 @@ impl WaybarBuilder {
self
}
pub(crate) fn muted(mut self, muted: bool) -> Self {
self.muted = muted;
self
}
pub(crate) fn build(self) -> Waybar {
Waybar {
text: self.text,
@ -50,6 +56,7 @@ impl WaybarBuilder {
tooltip: self.tooltip,
class: self.class,
percentage: self.percentage,
muted: self.muted
}
}
}
@ -61,6 +68,7 @@ pub(crate) struct Waybar {
tooltip: String,
class: String,
percentage: u8,
muted: bool,
}
impl Waybar {