tridactyl/tridactyl

Support/RFC: Use the keypad as single-handed "browsing remote"

Opened this issue · 3 comments

Making a feature request / getting help

  • Tridactyl version (:version): 1.23.0
  • Firefox version (Top right menu > Help > About Firefox): 120.0

Use the keypad as single-handed "browsing remote"

I was thinking on having a single-handed navigation using just the numeric keypad block. It has some advantages, especially for long browsing sessions:

  • The key layout is ortholinear (i.e. key rows are stacked instead of staggered), which might be ease some RSI.
  • Numpad is a rightmost on keyboard, so less arm twisting towards the keyboard center.
  • There are plenty of add-on keypads, even wireless, which might be of used as a sort of "browsing remote", ideal for 10-foot user interfaces.

As Tridactyl can provide numeric hints, being able to bind commands to keys in the numpad would be perfect. As I start reading the docs, I get to Mozilla's docs on keyboard events. However, binds like Multiply doesn't seem to work (as opposed to *). I'd like to all add,subtract and number keys to be differentiated from main keyboard counterparts, to assign the different functions.

Is that even possible? What would the syntax be?

Hi, we don't support directly binding to key objects, but you can use the keyboardlayout settings to override each keyboardEvent.code from https://developer.mozilla.org/en-US/docs/Web/API/UI_Events/Keyboard_event_code_values - which, NB, is not the same as the page you were on - you want to bind to to a character that you are unlikely to type (such as an emoji from https://emoji.muan.co/ )

set keyboardlayoutbase qwerty # whatever your keyboard is
set keyboardlayoutforce true
set keyboardlayoutoverrides.NumpadMultiply ✖️✖️ # second character is for shift+key, make it different if you like. sometimes it will work
bind ✖️ scrollline 10
reload

Code is untested because I don't have any keyboards that have numpads :)

Edit: you need beta 1.23.0-pre6585 or newer to use these settings

At some point, my addon went updated, so I decided to try it:

:version
1.24.1

As per your instructions, I did:

set keyboardlayoutforce true
set keyboardlayoutoverrides.Numpad5 f

Although it worked, I've found it comes with a major drawback: my keyboard layout changed from Spanish to US 😨, which makes it hardly usable 😢.
Luckily, I've found how to deal with this in keyboardlayoutforce docs (dropping here for reference). I'll get around to it when I have some more time.

Yeah, just follow the instructions https://tridactyl.xyz/build/static/docs/classes/_src_lib_config_.default_config.html#keyboardlayoutbase and I'd be happy to add a Spanish layout