diff --git a/src/bin/swayrd.rs b/src/bin/swayrd.rs index e1549fb..bc5bb0a 100644 --- a/src/bin/swayrd.rs +++ b/src/bin/swayrd.rs @@ -14,21 +14,12 @@ fn main() { Arc::new(RwLock::new(HashMap::new())); let subscriber_handle = thread::spawn(|| { - let x = proc::Command::new("swaymsg") - .arg("-t") - .arg("subscribe") - .arg("[window]") - .output() - .expect("Failed to subscribe to window events"); - println!( - "{}", - String::from_utf8(x.stdout).expect("Wrong string data!") - ); let child = proc::Command::new("swaymsg") .arg("--monitor") + .arg("--raw") .arg("-t") .arg("subscribe") - .arg("'[window]'") + .arg("[\"window\"]") .stdout(proc::Stdio::piped()) .spawn() .expect("Failed to subscribe to window events"); @@ -37,7 +28,10 @@ fn main() { let stream = Deserializer::from_reader(stdout).into_iter::(); for res in stream { match res { - Ok(msg) => println!("Got msg: {:?}", msg), + Ok(win_ev) => println!( + "WindowEvent {:?} for node {:?}", + win_ev.change, win_ev.container.id + ), Err(err) => panic!("{:?}", err), } } diff --git a/src/ipc.rs b/src/ipc.rs index fe72752..567f3a6 100644 --- a/src/ipc.rs +++ b/src/ipc.rs @@ -208,13 +208,6 @@ pub enum WindowEventType { Mark, } -#[derive(Deserialize, Debug)] -#[allow(dead_code)] -pub struct Reply { - pub success: bool, - pub error: String, -} - #[derive(Deserialize, Debug)] #[allow(dead_code)] pub struct WindowEvent {