From 5ec7ae026ce9d8c48ef5f0590a300fa308efa487 Mon Sep 17 00:00:00 2001 From: Irene Knapp Date: Wed, 25 Nov 2026 03:24:45 -0700 Subject: i3 mode module does the subscription now Force-Push: yes Change-Id: I2996d58c4eb605caa904f23f876853fc3eb9761d --- src/facility/i3.rs | 25 ++++++++----------------- 1 file changed, 8 insertions(+), 17 deletions(-) (limited to 'src/facility') 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 { + pub async fn command(&mut self, type_code: u32, body: &str) -> Result { 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 { -- cgit 1.4.1