about summary refs log tree commit diff
path: root/src/facility/i3.rs
diff options
context:
space:
mode:
authorIrene Knapp <ireneista@irenes.space>2026-11-25 03:24:45 -0700
committerIrene Knapp <ireneista@irenes.space>2026-11-25 03:24:45 -0700
commit5ec7ae026ce9d8c48ef5f0590a300fa308efa487 (patch)
treeb0f5b2e19d724a548ee36ad636d114666d201318 /src/facility/i3.rs
parent6ab1eb29d593af69aef18ddcfadd171c07aac2ed (diff)
i3 mode module does the subscription now
Force-Push: yes
Change-Id: I2996d58c4eb605caa904f23f876853fc3eb9761d
Diffstat (limited to 'src/facility/i3.rs')
-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>
   {