|
|
@ -14,21 +14,12 @@ fn main() { |
|
|
|
Arc::new(RwLock::new(HashMap::new())); |
|
|
|
Arc::new(RwLock::new(HashMap::new())); |
|
|
|
|
|
|
|
|
|
|
|
let subscriber_handle = thread::spawn(|| { |
|
|
|
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") |
|
|
|
let child = proc::Command::new("swaymsg") |
|
|
|
.arg("--monitor") |
|
|
|
.arg("--monitor") |
|
|
|
|
|
|
|
.arg("--raw") |
|
|
|
.arg("-t") |
|
|
|
.arg("-t") |
|
|
|
.arg("subscribe") |
|
|
|
.arg("subscribe") |
|
|
|
.arg("'[window]'") |
|
|
|
.arg("[\"window\"]") |
|
|
|
.stdout(proc::Stdio::piped()) |
|
|
|
.stdout(proc::Stdio::piped()) |
|
|
|
.spawn() |
|
|
|
.spawn() |
|
|
|
.expect("Failed to subscribe to window events"); |
|
|
|
.expect("Failed to subscribe to window events"); |
|
|
@ -37,7 +28,10 @@ fn main() { |
|
|
|
let stream = Deserializer::from_reader(stdout).into_iter::<ipc::WindowEvent>(); |
|
|
|
let stream = Deserializer::from_reader(stdout).into_iter::<ipc::WindowEvent>(); |
|
|
|
for res in stream { |
|
|
|
for res in stream { |
|
|
|
match res { |
|
|
|
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), |
|
|
|
Err(err) => panic!("{:?}", err), |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|