boppreh / keyboard

Hook and simulate global keyboard events on Windows and Linux.
MIT License
3.77k stars 433 forks source link

Stop capturing keystrokes on condition #523

Open ArtOfFugue66 opened 2 years ago

ArtOfFugue66 commented 2 years ago

Hi,

I have tried setting a boolean flag in the callback function and then checking it in the main thread but it does not stop the capturing of keyboard events. What would be the best way to unhook a callback when a certain condition is met?

Thanks!