Skip to content

Instantly share code, notes, and snippets.

@anjulalk
Last active January 23, 2021 12:30
Show Gist options
  • Star 1 You must be signed in to star a gist
  • Fork 1 You must be signed in to fork a gist
  • Save anjulalk/1ce1d16828f0727f385e2f6c4979cd7f to your computer and use it in GitHub Desktop.
Save anjulalk/1ce1d16828f0727f385e2f6c4979cd7f to your computer and use it in GitHub Desktop.
Anjula Karunarathne - GSoC 2020

Introduction

Joplin desktop application supports keyboard shortcuts to a certain degree. However, there wasn't an option for users to configure keyboard shortcuts according to their preferences. My project was to implement a keyboard shortcut editor along with the necessary integration.

The project consisted of two parts:

  1. Back-end service for handling all keymapping-related functionality
  2. Keyboard shortcut editor with the necessary functionality to alter the keymap

Progress

The project was implemented in two pull requests.

  1. Desktop: KeymapService: Initial implementation
  2. Desktop: Keyboard shortcut editor

PR 1 - Desktop: KeymapService: Initial implementation

KeymapService builds an in-memory keymap based on the default keymap configuration. Default keymap configuration may vary from platform to platform. Essentially, the in-memory keymap binds a keyboard shortcut for some command of Joplin. Clients of KeymapService may obtain the keyboard shortcuts for some commands, and/or alter the keymap via the provided methods.

Additionally, this PR also allows altering the keymap via a keymap file, which is located in the profile directory. Contents of this keymap file will take higher priority than the default keymap configuration, and will replace the default keyboard shortcuts.

It is guaranteed that the keymap always stays pristine with proper validation.

PR 2 - Desktop: Keyboard shortcut editor

Depending on the interfaces of KeymapService, Keyboard shortcut editor allows the user to,

  • View all the available commands and their respective keyboard shortcuts
  • Change, or disable a keyboard shortcut for some command
  • Restore a keyboard shortcut to its default value
  • Export all changes to a keymap file (in JSON format)
  • Import changes from an exported keymap file
  • Perform a simple search to locate some shortcut

Changes performed to the keymap will be reflected immediately in the keymap file located in the profile directory. The editor will also perform continuous validation to ensure that the keymap will not enter a dirty-state.

This PR also includes a lot of improvements to KeymapService to support these additional functions.

Documentation

Weekly Reports

Other documentation

  • Documentation for KeymapService can be found here.
  • UI sketches for the Keyboard shortcut editor can be found here.
  • All discussions can be found here.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment