about summary refs log tree commit diff
path: root/src/facility
diff options
context:
space:
mode:
Diffstat (limited to 'src/facility')
-rw-r--r--src/facility/i3.rs25
1 files changed, 8 insertions, 17 deletions
diff --git a/src/facility/i3.rs b/src/facility/i3.rs
index 0d1ad0f..d914548 100644
--- a/src/facility/i3.rs
+++ b/src/facility/i3.rs
@@ -131,25 +131,16 @@ impl CreatableFacility for I3 {
                          Arc::clone(&pending_commands),
                          Arc::clone(&event_subscribers)));
 
-    let mut i3 = I3 {
+    /*   Please notice that we don't send any initial commands or anything like
+     * that, we just assume it works. It's tested well enough that that ought
+     * to be true.
+     */
+    Ok(I3 {
       _read_socket: read_socket,
       write_socket,
       _receive_task: receive_task,
       pending_commands, event_subscribers,
-    };
-
-    let (sender, receiver) = unbounded();
-    if i3.subscribe(EventType::MODE, sender).await? {
-      executor.spawn(async move {
-        loop {
-          if let Ok((_, body)) = receiver.recv().await {
-            println!("it worked??? {}", body);
-          }
-        }
-      }).detach();
-    }
-
-    Ok(i3)
+    })
   }
 }
 
@@ -210,7 +201,7 @@ impl I3 {
     Err(Error::custom("i3 window manager socket not found"))
   }
 
-  async fn command(&mut self, type_code: u32, body: &str) -> Result<String> {
+  pub async fn command(&mut self, type_code: u32, body: &str) -> Result<String> {
     let (sender, receiver) = unbounded();
 
     {
@@ -232,7 +223,7 @@ impl I3 {
     Ok(response)
   }
 
-  async fn subscribe(&mut self, event_types: EventType,
+  pub async fn subscribe(&mut self, event_types: EventType,
                      sender: Sender<(EventType, String)>)
     -> Result<bool>
   {