Skip to content

Commit

Permalink
fix: release lock before sleeping (#320)
Browse files Browse the repository at this point in the history
Otherwise the lock is held almost continously while any kind of keyberon timer
is active. That (at least on Linux) prevents events which bypass kanata (such
as mouse movement) from being forwarded in a timly manner (resulting in delayed
and low-frequency mouse movement) because the event loop thread will be unable
to acquire the lock it needs to output events.
  • Loading branch information
Johni0702 authored Feb 22, 2023
1 parent c39d3f6 commit 321c9a6
Showing 1 changed file with 1 addition and 0 deletions.
1 change: 1 addition & 0 deletions src/kanata/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -1257,6 +1257,7 @@ impl Kanata {
(start.elapsed()).as_nanos()
);

drop(k);
std::thread::sleep(time::Duration::from_millis(1));
}
Err(TryRecvError::Disconnected) => {
Expand Down

0 comments on commit 321c9a6

Please sign in to comment.