local function Chinese()
hs.keycodes.setMethod("Pinyin - Simplified")
hs.keycodes.currentSourceID("com.apple.inputmethod.SCIM.ITABC")
hs.keycodes.currentSourceID("com.sogou.inputmethod.sogou.pinyin")
end
local function English()
hs.keycodes.setLayout("U.S.")
hs.keycodes.currentSourceID("com.apple.keylayout.ABC")
end
local function set_app_input_method(app_name, set_input_method_function, event)
event = event or hs.window.filter.windowFocused
hs.window.filter.new(app_name)
:subscribe(event, function()
set_input_method_function()
end)
end