在Karabiner上,我在其复杂的修改设置下启用了多个规则,例如 Emacs key bindings
.
我想知道是否有可能将这些启用规则仅用于特定的键盘布局,如 U.S.
并在我切换到另一种键盘布局时自动禁用这些规则。
不可能将现有的导入规则变成特定的设备。然而,如果你制定或修改这些规则,你可以。
https:/pqrs.orgosxkarabinerjson.html#condition-definition-device#。
如何制定自己的规则,其要点是在内部制作一个json文件
~/.config/karabiner/assets/complex_modifications/
你可以把json文件命名为任何你想要的名字,如果你喜欢,你甚至可以从其他地方把它链接起来。
所以,如果你有一个规则,你想让它成为特定的设备,复制粘贴到你的json文件中,然后从以下地方修改它 type: "basic"
至 type: "device_if"
并填写你的设备ID等,你可以从设备标签下的Karabiner EventViewer应用中获得。
从这里 指南
我在下面的代码中加入了 ~/.config/karabiner/karabiner.json
{
"manipulators": [
{
"conditions": [
{
"input_sources": [
{
"language": "en"
}
],
"type": "input_source_if"
}
],
"from": {
"key_code": "open_bracket"
},
"to": [
{
"key_code": "open_bracket",
"modifiers": [
"left_shift"
]
}
],
"type": "basic"
},
{
"conditions": [
{
"input_sources": [
{
"language": "en"
}
],
"type": "input_source_if"
}
],
"from": {
"key_code": "close_bracket",
"modifiers": {
"mandatory": [
"left_shift"
]
}
},
"to": [
{
"key_code": "close_bracket"
}
],
"type": "basic"
},
{
"conditions": [
{
"input_sources": [
{
"language": "en"
}
],
"type": "input_source_if"
}
],
"from": {
"key_code": "close_bracket"
},
"to": [
{
"key_code": "close_bracket",
"modifiers": [
"left_shift"
]
}
],
"type": "basic"
},
{
"conditions": [
{
"input_sources": [
{
"language": "en"
}
],
"type": "input_source_if"
}
],
"from": {
"key_code": "open_bracket",
"modifiers": {
"mandatory": [
"left_shift"
]
}
},
"to": [
{
"key_code": "open_bracket"
}
],
"type": "basic"
}
]
}
},