nowrep / wljoywake

Wayland idle inhibit on joystick input
GNU General Public License v2.0
26 stars 2 forks source link

fix: Exit if disconnected from wayland server #1

Closed vknauss closed 1 year ago

vknauss commented 1 year ago

I use sway and had put exec wljoywake in my sway config to run the program in the background when the wm launches. I noticed after doing some testing involving repeatedly starting/stopping sway that I had many instances of wljoywake still running, and each using very high CPU.

Turns out they were in a tight loop where the call to poll() on the wayland display fd, which had since been closed by the server when the wm shut down, was returning almost immediately.

With this patch, we just exit when the fd is closed by the server. I also added a call to wl_display_disconnect to handle quitting the program when still connected, and make sure resources are freed.

Thanks for the program! It is very useful.

nowrep commented 1 year ago

Thanks!