Fix #209 Improve keyboard shortcut handling