Open belm0 opened 5 years ago
Is this not already covered by the layouts/methods functions in http://www.hammerspoon.org/docs/hs.keycodes.html ?
No, I don't believe it's covered. This is a setting specific to the Japanese input method. (There are about 15 such settings but this one is essential since it's tied to keyboard layout.)
Whenever I execute setMethod('Hiragana')
, the current layout is forced to the layout configured in "Romaji layout" field of the Japanese input settings. It's not possible for me to change the layout via setLayout(...)
without the current method getting reset to nil.
> k=hs.keycodes
> for name, val in pairs(k.layouts()) do print(name, val) end
1 Dvorak
2 U.S.
> for name, val in pairs(k.methods()) do print(name, val) end
1 Hiragana
> k.setMethod('Hiragana')
true
> k.currentLayout(), k.currentMethod()
Dvorak Hiragana
> k.setLayout('U.S.')
true
> k.currentLayout(), k.currentMethod()
U.S. nil
> k.setMethod('Hiragana')
true
> k.currentLayout(), k.currentMethod()
Dvorak Hiragana
The "Japanese" input source contains various configuration, most important of which is "Romaji layout" which determines the underlying keyboard layout. So if you want Japanese input to work on multiple keyboards having different layouts, you'd need to set this configuration.