Add 'muted' property to JSON output
This commit is contained in:
parent
60192e44fa
commit
888ea9758b
2 changed files with 9 additions and 0 deletions
|
@ -427,6 +427,7 @@ impl HomeAssistant {
|
||||||
OutputFormat::Waybar => Waybar::builder()
|
OutputFormat::Waybar => Waybar::builder()
|
||||||
.text(text)
|
.text(text)
|
||||||
.percentage((volume_raw * 100.) as u8)
|
.percentage((volume_raw * 100.) as u8)
|
||||||
|
.muted(is_muted)
|
||||||
.build()
|
.build()
|
||||||
.to_string(),
|
.to_string(),
|
||||||
OutputFormat::I3Blocks => I3Blocks::builder().text(text).build().to_string(),
|
OutputFormat::I3Blocks => I3Blocks::builder().text(text).build().to_string(),
|
||||||
|
|
|
@ -11,6 +11,7 @@ pub(crate) struct WaybarBuilder {
|
||||||
tooltip: String,
|
tooltip: String,
|
||||||
class: String,
|
class: String,
|
||||||
percentage: u8,
|
percentage: u8,
|
||||||
|
muted: bool,
|
||||||
}
|
}
|
||||||
|
|
||||||
impl WaybarBuilder {
|
impl WaybarBuilder {
|
||||||
|
@ -43,6 +44,11 @@ impl WaybarBuilder {
|
||||||
self
|
self
|
||||||
}
|
}
|
||||||
|
|
||||||
|
pub(crate) fn muted(mut self, muted: bool) -> Self {
|
||||||
|
self.muted = muted;
|
||||||
|
self
|
||||||
|
}
|
||||||
|
|
||||||
pub(crate) fn build(self) -> Waybar {
|
pub(crate) fn build(self) -> Waybar {
|
||||||
Waybar {
|
Waybar {
|
||||||
text: self.text,
|
text: self.text,
|
||||||
|
@ -50,6 +56,7 @@ impl WaybarBuilder {
|
||||||
tooltip: self.tooltip,
|
tooltip: self.tooltip,
|
||||||
class: self.class,
|
class: self.class,
|
||||||
percentage: self.percentage,
|
percentage: self.percentage,
|
||||||
|
muted: self.muted
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -61,6 +68,7 @@ pub(crate) struct Waybar {
|
||||||
tooltip: String,
|
tooltip: String,
|
||||||
class: String,
|
class: String,
|
||||||
percentage: u8,
|
percentage: u8,
|
||||||
|
muted: bool,
|
||||||
}
|
}
|
||||||
|
|
||||||
impl Waybar {
|
impl Waybar {
|
||||||
|
|
Loading…
Add table
Reference in a new issue