swayipc-rs
swayipc-rs copied to clipboard
100% CPU usage after exiting Sway.
Thank you for this library, it works really well for me with only one issue.
When I use it to listen for events and exit my sway the process that is listening for events gets 100% CPU usage and never ends until I kill it.
Minimal test example:
use swayipc::{Connection, EventType, Fallible};
use swayipc_types::Event;
fn main() -> Fallible<()> {
let subs = [EventType::Window, EventType::Shutdown];
let sway = Connection::new()?;
for event in (sway.subscribe(subs)?).flatten() {
match event {
Event::Window(ev) => println!("{:?}", ev),
Event::Shutdown(_) => {
println!("shut down");
break;
}
_ => (),
}
}
Ok(())
}
After running this and exiting sway with:
swaymsg exit
Process does not end at all and uses 100% CPU instead. It doesn't look like Shutdown
is triggered either. I tied to test it by running command in separate terminal, outside of sway, and there is no output nor any error.