Add hotkey evaluation

Targets #396.
I intend to rewrite the key caching and playback, so this is WIP.
I guess we should add a macro for debugging calls like this, to exclude calls to the log function when building without debugging. I guess this would be beneficial in cases like this.

Shall I add this?