The main loop slept on time.sleep(event_deadline()), so a click sat in the datagram socket until the next 0.5s timer tick woke the loop. That added up to ~450ms of latency before the click affected state.json, on top of waybar's 1s re-poll. Replace the sleep with select() on the socket: select returns the moment a datagram arrives, so the loop drains and writes the click within milliseconds (measured 29ms) while still bounding idle sleep by the next timer deadline. Rotation cadence and click-during-fetch behavior are unchanged. The waybar custom-module interval stays 1: fractional intervals below 1s break custom modules (Waybar #4894 turns 0.5 into a 1ms busy loop), so the 0-1s re-poll is the floor and not safely tunable. |
||
|---|---|---|
| .. | ||
| ocd-waybar | ||
| ocd-waybar-ctl | ||