macoshammerspoon

How to set korean keyboard layout by hs.keycodes.setLayout()?


I want to change keyboard layout by using Hammerspoon.

To change Thai keyboard layout, this code works.

> hs.keycodes.setLayout("Thai")
true

But to change Korean keyboard, both codes doesn't work.

> hs.keycodes.setLayout("2-Set Korean")
false

> hs.keycodes.setLayout("Korean")
false

hs.keycodes.currentLayout() returns "2-Set Korean".

> hs.keycodes.currentLayout()
2-Set Korean

Where can I find corret keyboard layout name for each language?


Solution

  • Instead of setLayout() you need to use setMethod() for Korean input method.

    hs.keycodes.setMethod("2-Set Korean")