|
|
|
@ -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::<ipc::WindowEvent>(); |
|
|
|
|
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), |
|
|
|
|
} |
|
|
|
|
} |
|
|
|
|