aboutsummaryrefslogtreecommitdiff
path: root/pulse/src/communication.rs
diff options
context:
space:
mode:
authorAndreas Grois <andi@grois.info>2021-05-01 22:16:54 +0200
committerAndreas Grois <andi@grois.info>2021-05-01 22:16:54 +0200
commit18a96163d730b7e44270603a4c6de071b725db5f (patch)
treee91e9d23eec5031d9be7f1422b147c05d44a25d7 /pulse/src/communication.rs
parent00a3332d9a986f650283416dccf25aa9f2d32aa6 (diff)
First draft of pulse architecture.
Diffstat (limited to 'pulse/src/communication.rs')
-rw-r--r--pulse/src/communication.rs37
1 files changed, 37 insertions, 0 deletions
diff --git a/pulse/src/communication.rs b/pulse/src/communication.rs
new file mode 100644
index 0000000..c8578b7
--- /dev/null
+++ b/pulse/src/communication.rs
@@ -0,0 +1,37 @@
+use std::sync::mpsc::*;
+use crate::runnable::*;
+use swaystatus_plugin::*;
+
+pub enum MessagesFromMain {
+ Quit,
+ Refresh
+}
+
+pub struct SenderForMain {
+ sender : Sender<MessagesFromMain>,
+ pulse_loop : std::sync::Arc<PulseMainLoop>
+}
+
+impl<'p> SenderForMain {
+ pub fn new(sender : Sender<MessagesFromMain>, pulse_loop : std::sync::Arc<PulseMainLoop>) -> Self {
+ SenderForMain{
+ sender,
+ pulse_loop
+ }
+ }
+
+ fn send(&self, message : MessagesFromMain) -> Result<(), PluginCommunicationError>
+ {
+ //TODO!!!!
+ Ok(())
+ }
+}
+
+impl MsgMainToModule for SenderForMain {
+ fn send_quit(&self) -> Result<(), PluginCommunicationError> {
+ self.send(MessagesFromMain::Quit)
+ }
+ fn send_refresh(&self) -> Result<(), PluginCommunicationError> {
+ self.send(MessagesFromMain::Refresh)
+ }
+}