It seems that Windows is frequently disconnecting the keyboard hook
(eventually if swift was too busy processing messages) and caused all hotkeys
to be unreliable.
Instead use a polling mechanism. The previous method is kept in code for
testing, but is disabled by compile time switch.