Safe Haskell | Safe-Inferred |
---|
Handle physical_key
layout.
Synopsis
- physical_key :: CallStack.Stack => Char -> Char
- pitch_map :: Map Char Pitch.Pitch
key layout
physical_key :: CallStack.Stack => Char -> Char Source #
Map a physical key, written relative to USA qwerty layout, to whatever character that key actually emits (if the layout is already USA qwerty then it's id of course). This is for layouts which should be done based on physical key position, like piano-style keyboards. It makes the overlapping-ness of non-mapped keys hard to predict though.
Since it's intended to map literal key characters, there is no accomodation for failure. Really this should be done at compile time, so it's conceptually a compile time error.
TODO isn't there some way I can get this at compile time? template haskell?
This uses #ifdef TESTING to avoid depending on Local.KeyLayout in tests. It's hardcoded to dvorak because that's what I used before, if anyone ever cares it could switch to qwerty.
The alternative to CPP would be pass layout in StaticConfig as a runtime parameter. But that would require a bunch of extra work, e.g. keymaps would then need a separate PhysicalKey type wrapper and a resolution step.