Improve keyboard shortcut handling

Part of https://github.com/kyoshino/bzdeck/issues/209