diff options
| author | Andreas Grois <andi@grois.info> | 2021-05-01 22:16:54 +0200 |
|---|---|---|
| committer | Andreas Grois <andi@grois.info> | 2021-05-01 22:16:54 +0200 |
| commit | 18a96163d730b7e44270603a4c6de071b725db5f (patch) | |
| tree | e91e9d23eec5031d9be7f1422b147c05d44a25d7 /pulse/src/runnable.rs | |
| parent | 00a3332d9a986f650283416dccf25aa9f2d32aa6 (diff) | |
First draft of pulse architecture.
Diffstat (limited to 'pulse/src/runnable.rs')
| -rw-r--r-- | pulse/src/runnable.rs | 36 |
1 files changed, 36 insertions, 0 deletions
diff --git a/pulse/src/runnable.rs b/pulse/src/runnable.rs new file mode 100644 index 0000000..d77a132 --- /dev/null +++ b/pulse/src/runnable.rs @@ -0,0 +1,36 @@ +use std::sync::mpsc::*; +use crate::config::*; +use swaystatus_plugin::*; +use crate::communication::*; + +pub struct PulseVolumeRunnable<'p> { + config : &'p PulseVolumeConfig, + to_main : Box<dyn MsgModuleToMain + 'p>, + from_main : Receiver<MessagesFromMain>, + pulse : std::sync::Arc<PulseMainLoop> +} + +impl<'p : 's, 's> PulseVolumeRunnable<'p> { + pub fn new(config : &'p PulseVolumeConfig, to_main : Box<dyn MsgModuleToMain + 'p>) -> (Self, SenderForMain) { + let (s, r) = channel(); + let pulse = std::sync::Arc::new(PulseMainLoop {});//TODO: initialize this properly + let result = PulseVolumeRunnable { + config, + to_main, + from_main : r, + pulse: pulse.clone() + }; + let sender = SenderForMain::new(s, pulse); + (result, sender) + } +} + +impl<'p> SwayStatusModuleRunnable for PulseVolumeRunnable<'p> { + fn run(&self) { + //TODO + } +} + +pub struct PulseMainLoop { + //TODO! +} |
