aboutsummaryrefslogtreecommitdiff
path: root/alsa/src/lib.rs
diff options
context:
space:
mode:
authorAndreas Grois <andi@grois.info>2024-01-24 21:40:48 +0100
committerAndreas Grois <andi@grois.info>2024-01-24 21:40:48 +0100
commit57fd648407a233ae62b2c561d902783597274f83 (patch)
tree6c4149d45eebfd3374d18c61ff766c8e0814f322 /alsa/src/lib.rs
parent3f362de1ab94b994ef4ccdc403cab4cb8d0d1bcb (diff)
Start work on ALSA volume display
Diffstat (limited to 'alsa/src/lib.rs')
-rw-r--r--alsa/src/lib.rs36
1 files changed, 36 insertions, 0 deletions
diff --git a/alsa/src/lib.rs b/alsa/src/lib.rs
new file mode 100644
index 0000000..42800c8
--- /dev/null
+++ b/alsa/src/lib.rs
@@ -0,0 +1,36 @@
+use swaystatus_plugin::*;
+
+mod config;
+mod communication;
+mod runnable;
+
+use config::AlsaVolumeConfig;
+
+pub struct AlsaVolumePlugin;
+impl SwayStatusModule for AlsaVolumePlugin {
+ fn get_name(&self) -> &str {
+ "AlsaVolume"
+ }
+ fn deserialize_config<'de, 'p>(&'p self, deserializer : &mut (dyn erased_serde::Deserializer + 'de)) -> Result<Box<dyn SwayStatusModuleInstance + 'p>,erased_serde::Error> {
+ erased_serde::deserialize::<AlsaVolumeConfig>(deserializer)
+ .map(|c| Box::new(c) as Box<dyn SwayStatusModuleInstance>)
+ }
+ fn get_default_config<'p>(&'p self) -> Box<dyn SwayStatusModuleInstance + 'p> {
+ todo!();
+ }
+ fn print_help(&self) {
+ println!(
+r#"Swaystatus Alsa Volume plugin.
+
+This is a volume display for ALSA. You can either choose a specific device, mixer and element to display, or just show the default output's volume."#
+ );
+ }
+}
+
+impl AlsaVolumePlugin {
+ fn new() -> Self {
+ Self
+ }
+}
+
+declare_swaystatus_module!(AlsaVolumePlugin, AlsaVolumePlugin::new);