From 9549395257a22d4f03f5175602adf9980802a6cd Mon Sep 17 00:00:00 2001 From: Andreas Grois Date: Mon, 29 Nov 2021 00:18:44 +0100 Subject: Update pulse help string and add a few serde renames. --- pulse/src/config.rs | 7 +++++-- pulse/src/lib.rs | 38 ++++++++++++++++++++++++++++++++++++-- 2 files changed, 41 insertions(+), 4 deletions(-) (limited to 'pulse/src') diff --git a/pulse/src/config.rs b/pulse/src/config.rs index 740190d..f95bd46 100644 --- a/pulse/src/config.rs +++ b/pulse/src/config.rs @@ -51,8 +51,11 @@ enum FieldSorting { enum FormatableMute { Off, Symbol { + #[serde(rename = "Label")] label : String, + #[serde(rename = "MuteSymbol")] mute_symbol : String, + #[serde(rename = "UnmuteSymbol")] unmute_symbol : String } } @@ -106,7 +109,7 @@ impl Default for PulseVolumeConfig { fn default() -> Self { PulseVolumeConfig { sink : Sink::Default, - volume : FormatableVolume::Numeric { label : String::from(" "), digits : 0 }, + volume : FormatableVolume::Numeric { label : String::from(""), digits : 0 }, balance : FormatableVolume::Binned { label : String::from(" "), bin_symbol_map : { @@ -117,7 +120,7 @@ impl Default for PulseVolumeConfig { a } }, - mute : FormatableMute::Symbol { label : String::new(), mute_symbol : String::from("🔇"), unmute_symbol : String::from(" ") }, + mute : FormatableMute::Symbol { label : String::new(), mute_symbol : String::from("🔇"), unmute_symbol : String::from("🔊") }, sorting : FieldSorting::MuteVolumeBalance, } } diff --git a/pulse/src/lib.rs b/pulse/src/lib.rs index cfecfd4..a77acba 100644 --- a/pulse/src/lib.rs +++ b/pulse/src/lib.rs @@ -20,11 +20,45 @@ impl SwayStatusModule for PulseVolumePlugin { Box::new(config) } fn print_help(&self) { - //TODO! println!( r#"Swaystatus Pulseaudio Volume plugin. -Sorry, this help has not been finalized. If this ever gets public, slap Andi."#); +This is a volume display for pulseaudio (or compatibles). It can either monitor the default sink and switch whenever the default changes, or it can monitor a specific sink given by a configured name. The volume information can either be printed numerically or as a symbol that can be set based on a percentage range. In addition, the mute, volume and balance display can be arranged in any way wanted. + +The configuration for this plugin looks like this: +[Element.Config] +Sorting = ["MuteVolumeBalance", "MuteBalanceVolume", "VolumeMuteBalance", "VolumeBalanceMute", "BalanceMuteVolume", "BalanceVolumeMute"] + +[Element.Config.Sink] +Sink = ["Default", "Specific"] +SinkName = + +[Element.Config.Volume] +Format = ["Off", "Numeric", "Binned"] +Label = +DecimalDigits = + +[Element.Config.Volume.PercentToSymbolMap] + + +[Element.Config.Balance] +Format = ["Off", "Numeric", "Binned"] +Label = +DecimalDigits = + +[Element.Config.Balance.PercentToSymbolMap] + + +[Element.Config.Mute] +Format = ["Off", "Symbol"] +Label = +MuteSymbol = +UnmuteSymbol = + +Sorry if this is overly complicated. Using the -s command line switch to get a sample configuration should clarify things. + + +Thanks to Jason White, whose gist https://gist.github.com/jasonwhite/1df6ee4b5039358701d2 was immensely helpful when it comes to interaction with the pulseaudio daemon."#); } } -- cgit v1.2.3