aboutsummaryrefslogtreecommitdiff
path: root/alsa/src/lib.rs
blob: 42800c877dfba1b5b6fea11894e9ccf2d3bbbb1b (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
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);