Skip to content

Instantly share code, notes, and snippets.

@whitemuu
Last active June 5, 2019 13:37
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save whitemuu/cb784e88881dec04b2f9631c46ffbc10 to your computer and use it in GitHub Desktop.
Save whitemuu/cb784e88881dec04b2f9631c46ffbc10 to your computer and use it in GitHub Desktop.

init.lua

function cycleInputMethod()
  if hs.keycodes.currentSourceID() == "com.apple.keylayout.US" then
    hs.keycodes.currentSourceID("com.apple.inputmethod.SCIM.ITABC" )
  elseif hs.keycodes.currentSourceID() == "com.apple.inputmethod.SCIM.ITABC" then
    hs.keycodes.currentSourceID("com.apple.inputmethod.Kotoeri.Japanese")
  elseif hs.keycodes.currentSourceID() == "com.apple.inputmethod.Kotoeri.Japanese" then
    hs.keycodes.currentSourceID("com.apple.keylayout.US")
  end
end

mB[#mB+1] = hs.hotkey.bind({"shift", "ctrl", "cmd"}, "I", cycleInputMethod)

karabiner.xml

<item>
    <name>Shift_R to Shift_R</name>
    <appendix>(+ When you type Shift_R only, send s-S-C-i)</appendix>
    <identifier>nichijou.remap.shiftR2shiftRRR</identifier>
    <autogen>
        __KeyOverlaidModifier__
        KeyCode::SHIFT_R,
        KeyCode::SHIFT_R,
        KeyCode::I, ModifierFlag::COMMAND_L | ModifierFlag::SHIFT_L | ModifierFlag::CONTROL_L
    </autogen>
</item>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment