Week 5: Custom Keyboard Shortcuts

I’ve posted some initial designs for the keyboard shortcut editor panel. I’ll start implementing the UI from feedback given for the designs.

I’ve also added an utility method to convert cross-platform Electron Accelerators to match the current platform. For example, the shortcut CommandOrControl+N will be shown as Command+N or Cmd+N for macOS users, and Control+N or Ctrl+N for everyone else.

Unit tests have also been improved for testing following cases:

  • Ensure no warnings are logged on a successful loading of keymap-desktop.json file.
  • Keymap configurations in the JSON file containing invalid Accelerators should be rejected (i.e. { "newNoteItem": "options", "accelerator": "F16" })
  • Invalid commands should also be rejected (i.e. { "command": "totallyInvalidCommand", "accelerator": "Control+Shift+M" })
  • When the JSON file contains a duplicate, the entire file is rejected and all shortcuts should be their default values.
2 Likes