Homepage    |    GitHub    |    API    |    FAQ

Detect duplicates in context-limited shortcuts

While currently there are no keyboard shortcuts that are limited to just one context, I agree that it’ll be a useful improvement in the future. I can imagine some use cases for such feature. Maybe shortcuts that are limited to just the note list, or the notebook list, or some shortcuts specific to WYSIWYG or just one editor.

Just checking if shortcuts are unique isn’t enough in this case. It would be useful to reuse the keyboard shortcut that is only available in the note list, somewhere else in the application. I think we can fix this by checking if the shortcuts are unique within their own context.

I suggest the following data structure for the shortcuts:

{ accelerator: 'Control+N', command: 'newNoteItem', context: 'default' }

Using this structure, we can specify a shortcut limited to note list: select all menu as following:

{ accelerator: 'Control+Shift+M', command: 'moveToNotebook', context: 'noteListSelectAll' }

If something like this is implemented in the future, while it is a different context than default, keyboard shortcuts in the default context should still be enabled. (Just my opinion) Otherwise user has to “exit” the current context to use their familiar shortcuts. Shortcuts of default context are, quote, unquote, “Global shortcuts” throughout the application.

We should be able to reuse the above shortcut in some other context:
(Let’s just assume this shortcut is only available if you’re focused in the sidebar, and nowhere else)

{ accelerator: 'Control+Shift+M', command: 'newNotebook', context: 'sidebar' }

In conclusion, a shortcut is duplicate if:

  • Context is default, and it’s already used
  • Context is not default, but it’s already used in default context

It’s not a duplicate if:

  • Context is default, and it’s not already used
  • Context is not default, and it’s not used in default context (but maybe in some other context)

Moved conversation:

1 Like