Mac 上如何优雅地切换三个输入法?

2019-06-05 20:07:34 +08:00
 nichijou

我需要切换三个输入法

https://i.loli.net/2019/06/05/5cf79a690d23162842.png

然而 command-SPC 切换的方式太慢了

目前我是用 karabiner 设置 option-1/2/3 分别对应三种输入法,但使用过程依然觉得不流畅(需要去思考按什么),而且在 EL Capitan 下有“切换后图标改变但输入仍是英文”的 bug。

见到过最优的切换方式应该是 Gboard: 她会在你最近使用的两个输入法间切换,如果切换后你未使用当前输入法进行任何输入,则判定你需要第三种输入法,再按小地球就会切换第三种输入法。

但该方法似乎只能在输入法内部实现。

现在我能想到最好的就是通过 hammerspoon 按顺序切换三种输入法,然后在通过 karabiner 把它赋予右 shift。

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

你有什么好的设计思路吗?

或者最新版本的 MacOS 有什么变化么?

3115 次点击
所在节点    macOS
4 条回复
aec4d
2019-06-05 21:17:19 +08:00
我只有两种输入法,切换方案是这样的,如果短按左 shift 就映射为切换输入法,长按就认为是默认 shift
应该三个输入法也能用
"complex_modifications": {
"parameters": {
"basic.simultaneous_threshold_milliseconds": 50,
"basic.to_delayed_action_delay_milliseconds": 500,
"basic.to_if_alone_timeout_milliseconds": 1000,
"basic.to_if_held_down_threshold_milliseconds": 500,
"mouse_motion_to_scroll.speed": 100
},
"rules": [
{
"manipulators": [
{
"description": "Change left_shift to command+control+option+shift+p.",
"from": {
"key_code": "left_shift",
"modifiers": {
"optional": [
"any"
]
}
},
"to": [
{
"key_code": "left_shift"
}
],
"to_if_alone": [
{
"key_code": "p",
"modifiers": [
"left_command",
"left_control",
"left_option",
"left_shift"
]
}
],
"type": "basic"
}
]
}
]
}
nichijou
2019-06-05 21:28:58 +08:00
@aec4d

我原来也是这么来的,现在也大概如此。不过不需要这么复杂,还是新的 karabiner 改了?

老版实现你的只要 __KeyOverlaidModifier__ 即可

https://gist.github.com/whitemuu/cb784e88881dec04b2f9631c46ffbc10
ewBuyVmLZMZE
2019-06-06 13:49:09 +08:00


可以用这个。MLSwitch2
nichijou
2019-06-06 17:06:37 +08:00

这是一个专为移动设备优化的页面(即为了让你能够在 Google 搜索结果里秒开这个页面),如果你希望参与 V2EX 社区的讨论,你可以继续到 V2EX 上打开本讨论主题的完整版本。

https://www.v2ex.com/t/571261

V2EX 是创意工作者们的社区,是一个分享自己正在做的有趣事物、交流想法,可以遇见新朋友甚至新机会的地方。

V2EX is a community of developers, designers and creative people.

© 2021 V2EX