use swaystatus_plugin::*; mod runnable; mod config; mod communication; use config::*; pub struct PulseVolumePlugin; impl SwayStatusModule for PulseVolumePlugin { fn get_name(&self) -> &str { "PulseVolume" } fn deserialize_config<'de>(&self, deserializer : &mut (dyn erased_serde::Deserializer + 'de)) -> Result, erased_serde::Error> { let result : PulseVolumeConfig = erased_serde::deserialize(deserializer)?; Ok(Box::new(result)) } fn get_default_config(&self) -> Box { let config = PulseVolumeConfig::default(); Box::new(config) } fn print_help(&self) { println!( r#"Swaystatus Pulseaudio Volume plugin. 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."#); } } impl PulseVolumePlugin { fn new() -> Self { Self } } declare_swaystatus_module!(PulseVolumePlugin, PulseVolumePlugin::new);