Koushien / keyboard-shortcut-api

A webextension experiment that aliases commands for native keyboard shortcuts.

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Keyboard Shortcut API

This repo contains a prototype API implemented as a WebExtension Experiment for Firefox that aims to address Bug 1215061 - Better keyboard shortcut support as mentioned in comment 44. This API triggers Firefox's native shortcuts programmatically.

While extensions such as Vimium-FF and Saka Key make do only with what's provided to regular WebExtensions, prior art in Vimium demonstrates limitations. These include loss of functionality on protected pages requiring non-Vimium motions to navigate away from and Vimium needing to implement its own location and findbar. In tandem with Colin Caine's Keyboard API, this API landing means a user can define their own motions for Firefox's shortcuts and be usable anywhere they normally are. It is our hope this use will go a long way in Vimperator or Pentadactyl successors.

Usage

  1. Get the latest Firefox Nightly.
  2. Ensure extensions.legacy.enabled is set to "true" in about:config (an Experiment is really a legacy extension).
  3. Enter about:debugging and load keyboard-shortcut-api/schema.json to load the API.
  4. Load /test-extension/manifest.json to load our test extension that adds a browser action (i.e., a button on your toolbar) which opens a sample page that calls the functions our API returns.

Considerations for reviewers

  • Currently, the implementation to toggle caret browsing with F7 is hardcoded inside source/toolkit/content/widgets/browser.xml. Is there any intent to encapsulate this? If not, is the verbatim reuse in the API acceptable?
  • If at all, how would you like tests to work?
  • As of September 24 2017, we notice that gDevToolsBrowser contains a function onKeyShortcut() that is not exposed. Our API could be made more concise using this call.
  • Related, gDevToolsBrowser.getDeveloperToolbar() seems to be the best way to get the developer toolbar but is also not exposed. We currently have no implementation to toggle the toolbar.
  • Though not shortcuts, we've implemented functions that check if the current page is in fullscreen, reader mode or in caret browsing.
  • If we can manage, we intend to implement a new shortcut here that focuses tab content, escaping from browser chrome. Do we have approval for this? A tentative implementation has been added, but hasn't been determined to be robust.

About

A webextension experiment that aliases commands for native keyboard shortcuts.

License:Mozilla Public License 2.0


Languages

Language:JavaScript 99.4%Language:HTML 0.6%