Is your feature request related to a problem? Please describe.
Thorium keyboards bind a key plus a set of modifiers to a list of macros. Shift,
command, option, and control all work as modifiers, they get pushed into the
key's meta array and are matched exactly, so A and Shift+A are
separate bindings.
Caps Lock is the odd one out. Today it sits in a middle ground that serves
nobody well:
- It does nothing as a modifier. Caps Lock never sets
shiftKey, and
nothing in the codebase calls getModifierState, so as far as a Thorium
keyboard is concerned Caps-on A and plain A are byte-identical. There is
no way to get a second layer of bindings out of the existing key set.
- It is bindable as a key, but it's unreliable The shared key layout gives it
keyCode: "CapsLock", so you can assign macros directly to it. But the
Keyboard client only listens for keydown, and on macOS the browser
emits keydown only when Caps turns on and keyup when it turns off —
which would mean the macro fires on every other press.
Describe the solution you'd like
Treat Caps Lock as a layer. When the lock is engaged, the Keyboard client
pushes "caps" into meta, exactly like shift/control/option. A and Caps+A
then become separate bindings with separate macro lists, and Caps can be
combined with the other modifiers.
Thankfully, we don't need to change much. meta is already fully generic
end-to-end — it's [String] with no enum and no validation anywhere — so the
server matching logic, the Key class, snapshot persistence, and keyboard
import/export all handle a new modifier string without modification. The change
is confined to:
src/components/views/Keyboard/index.jsx — read
getModifierState("CapsLock") and push "caps" into meta.
src/containers/FlightDirector/Keyboards/keyboardControl.jsx — make Caps a
meta toggle in the config UI.
src/components/views/Widgets/keyboard.jsx — Caps drops its keyCode and
becomes a modifier entry like lshift.
Reading the lock state during the letter key's keydown also sidesteps the
macOS quirk described above entirely, since we never depend on the Caps key's
own event.
Describe alternatives you've considered
I'm attempting to add an additional layer to our quartz keyboard that will optionally allow us to play lighting effects tied to the sound keyboard. (Like playing a cool lighting effect when you play the warp sound) But we want to make it optional, so FDs don't have to use it if they don't want to.
Additional context
Technically, because it can be used as a keybinding now, this could be a breaking change. I doubt that it's currently being used (because of the double touch bug), but it is what it is.
Is your feature request related to a problem? Please describe.
Thorium keyboards bind a key plus a set of modifiers to a list of macros. Shift,
command, option, and control all work as modifiers, they get pushed into the
key's
metaarray and are matched exactly, soAandShift+Aareseparate bindings.
Caps Lock is the odd one out. Today it sits in a middle ground that serves
nobody well:
shiftKey, andnothing in the codebase calls
getModifierState, so as far as a Thoriumkeyboard is concerned Caps-on
Aand plainAare byte-identical. There isno way to get a second layer of bindings out of the existing key set.
keyCode: "CapsLock", so you can assign macros directly to it. But theKeyboard client only listens for
keydown, and on macOS the browseremits
keydownonly when Caps turns on andkeyupwhen it turns off —which would mean the macro fires on every other press.
Describe the solution you'd like
Treat Caps Lock as a layer. When the lock is engaged, the Keyboard client
pushes
"caps"intometa, exactly like shift/control/option.AandCaps+Athen become separate bindings with separate macro lists, and
Capscan becombined with the other modifiers.
Thankfully, we don't need to change much.
metais already fully genericend-to-end — it's
[String]with no enum and no validation anywhere — so theserver matching logic, the
Keyclass, snapshot persistence, and keyboardimport/export all handle a new modifier string without modification. The change
is confined to:
src/components/views/Keyboard/index.jsx— readgetModifierState("CapsLock")and push"caps"intometa.src/containers/FlightDirector/Keyboards/keyboardControl.jsx— make Caps ameta toggle in the config UI.
src/components/views/Widgets/keyboard.jsx— Caps drops itskeyCodeandbecomes a modifier entry like
lshift.Reading the lock state during the letter key's
keydownalso sidesteps themacOS quirk described above entirely, since we never depend on the Caps key's
own event.
Describe alternatives you've considered
I'm attempting to add an additional layer to our quartz keyboard that will optionally allow us to play lighting effects tied to the sound keyboard. (Like playing a cool lighting effect when you play the warp sound) But we want to make it optional, so FDs don't have to use it if they don't want to.
Additional context
Technically, because it can be used as a keybinding now, this could be a breaking change. I doubt that it's currently being used (because of the double touch bug), but it is what it is.