diff options
| -rw-r--r-- | clock/src/lib.rs | 2 | ||||
| -rw-r--r-- | pulse/src/config.rs | 7 | ||||
| -rw-r--r-- | pulse/src/lib.rs | 38 | ||||
| -rw-r--r-- | testconfig | 6 |
4 files changed, 45 insertions, 8 deletions
diff --git a/clock/src/lib.rs b/clock/src/lib.rs index 76f5ea7..adde06e 100644 --- a/clock/src/lib.rs +++ b/clock/src/lib.rs @@ -184,7 +184,7 @@ Seconds = <float> The format is directly passed on to chrono and uses the strftime format. For available formatting options please see https://docs.rs/chrono/0.4.19/chrono/format/strftime/index.html or the strftime(3) man page. For the RefreshRate you can choose between two options. Unless you have a very special use case, you'll likely want to use the UtcSynchronized option. As the name implies this mode aims to update in sync with your computer's system clock. For instance, if you set it to update every second, the text of the clock will update within a few milliseconds after a full second of the system clock passed. -Since it synchronizes with UTC, and time zones are in general offset by multiples of 30 minutes, 30 minutes has been chosen as maximum time between updates. Following the "make invalid states unrepresentable" paradigm, the actual update rate is set as a fraction of 30 minutes. For example, if you want to update every second, the "PerThirtyMinutes" field needs to be set to 1800. If you need updates every minute, you'll want toset "PerThirtyMinutes" to 30. Beware that setting PerThirtyMinutes above 36000 is not supported. +Since it synchronizes with UTC, and time zones are in general offset by multiples of 30 minutes, 30 minutes has been chosen as maximum time between updates. Following the "make invalid states unrepresentable" paradigm, the actual update rate is set as a fraction of 30 minutes. For example, if you want to update every second, the "PerThirtyMinutes" field needs to be set to 1800. If you need updates every minute, you'll want to set "PerThirtyMinutes" to 30. Beware that setting PerThirtyMinutes above 36000 is not supported. The other option, "NotSynchronized" is for cases where 30/n minutes as an update rate is not desired. This simply waits approximately Seconds seconds between updates, but does not care about any synchronization to UTC. In other words, if you set this to 24 hours update rate, but launch the program at noon, that's when your date will update instead of midnight. Long story short, this mode only exists because it was easy to implement, and will probably never be useful to anybody."# ); 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 = <if Sink = "Specific": Sink name to observe. Omit if Sink = "Default".> + +[Element.Config.Volume] +Format = ["Off", "Numeric", "Binned"] +Label = <if Format != "Off" string to print in front of actual value. Omit if Format = "Off"> +DecimalDigits = <if Format = "Numeric" the number of digits after the comma. Omit otherwise.> + +[Element.Config.Volume.PercentToSymbolMap] +<if Format = "Binned" this map has to be filled in. It's a set of key-value-pairs where the key denotes the lower limit of a range. For instance writing 20 = "AAA" makes volumes above 20% print AAA. See sample config -s for an example.> + +[Element.Config.Balance] +Format = ["Off", "Numeric", "Binned"] +Label = <if Format != "Off" string to print in front of actual value. Omit if Format = "Off"> +DecimalDigits = <if Format = "Numeric" the number of digits after the comma. Omit otherwise.> + +[Element.Config.Balance.PercentToSymbolMap] +<see Element.Config.Volume.PercentToSymbolMap for details. It's the same thing, just allows negative values> + +[Element.Config.Mute] +Format = ["Off", "Symbol"] +Label = <if Format = "Symbol" string to print in front of symbol. Omit if Format = "Off"> +MuteSymbol = <if Format = "Symbol" the string to display if muted. Omit if Format = "Off"> +UnmuteSymbol = <if Format = "Symbol" the string to display if unmuted. Omit if Format = "Off"> + +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."#); } } @@ -40,9 +40,9 @@ Label = " " [Element.Config.Mute] Format = "Symbol" -label = "" -mute_symbol = "🔇" -unmute_symbol = "🔊" +Label = "" +MuteSymbol = "🔇" +UnmuteSymbol = "🔊" [Element.General] BeforeText = "" |
