雷蛇鼠标在驱动在macOS下支持不太好,最高只能安装雷云2,用户体验不太好。每次开机要拔掉鼠标重新安装才可以识别鼠标。
关于macOS下安装雷云2见我以前的这篇文章: 《macOS Big Sur中雷蛇鼠标驱动 雷云2.0无法正常使用解决办法与mac雷蛇卸载》 https://blog.csdn.net/lxyoucan/article/details/112403568
那么有没有什么方法可解决macOS下鼠标按键定义呢?答案是可以。
Karabiner-Elements适用于 macOS 的强大且稳定的键盘定制器。 https://karabiner-elements.pqrs.org/
启用鼠标默认是没有启用鼠标设置的,可以在这里启用。 适用于 macOS 的强大且稳定的键盘定制器。
如上图,我把侧面按键设置成a和b。
这样鼠标侧面按键就成a和b 了。
显然上面的单键映射无法满足我,我需要使用鼠标左侧的按键来切换虚拟桌面。如何实现呢?
这个配置可能不完全符合我们的要求,如何来修改呢?
可以直接去修改这个json,修改完这个json后,放到以下这个页面的输入框之中。 https://genesy.github.io/karabiner-complex-rules-generator/
粘贴完成以后,点击INSTSLL!
我的json配置分享:
{
"title": "ITKEY Mouse 3/4/5 desktop switcher",
"rules": [
{
"description": "Mouse 5 Switch Left",
"manipulators": [
{
"type": "basic",
"from": {
"pointing_button": "button5"
},
"to": [
{
"repeat": false,
"key_code": "left_arrow",
"modifiers": [
"left_control"
]
}
]
}
]
},
{
"description": "Mouse 4 Switch Right",
"manipulators": [
{
"type": "basic",
"from": {
"pointing_button": "button4"
},
"to": [
{
"repeat": false,
"key_code": "right_arrow",
"modifiers": [
"left_control"
]
}
]
}
]
},
{
"description": "Mouse 3 Desktop Switcher",
"manipulators": [
{
"type": "basic",
"from": {
"pointing_button": "button3"
},
"to": [
{
"repeat": false,
"key_code": "up_arrow",
"modifiers": [
"left_control"
],
"lazy": false
}
]
}
]
}
]
}
好用的配置
Caps Lock → Hyper Key (⌃⌥⇧⌘) (Caps Lock if alone)
{
"title": "Caps Lock → Hyper Key (⌃⌥⇧⌘) (Caps Lock if alone)",
"rules": [
{
"description": "Caps Lock → Hyper Key (⌃⌥⇧⌘) (Caps Lock if alone)",
"manipulators": [
{
"from": {
"key_code": "caps_lock"
},
"to": [
{
"key_code": "left_shift",
"modifiers": [
"left_command",
"left_control",
"left_option"
]
}
],
"to_if_alone": [
{
"key_code": "caps_lock"
}
],
"type": "basic"
}
]
}
]
}
yabai窗口焦点切换
{
"title": "yabai window focus",
"rules": [
{
"description": "Hyper Key h/j/k/l",
"manipulators": [
{
"type": "basic",
"from": {
"key_code": "h",
"modifiers": {
"mandatory": [
"left_shift",
"left_command",
"left_control",
"left_option"
],
"optional": [
"any"
]
}
},
"to": [
{
"shell_command": "/usr/local/bin/yabai -m window --focus west"
}
]
},{
"type": "basic",
"from": {
"key_code": "l",
"modifiers": {
"mandatory": [
"left_shift",
"left_command",
"left_control",
"left_option"
],
"optional": [
"any"
]
}
},
"to": [
{
"shell_command": "/usr/local/bin/yabai -m window --focus east"
}
]
},{
"type": "basic",
"from": {
"key_code": "j",
"modifiers": {
"mandatory": [
"left_shift",
"left_command",
"left_control",
"left_option"
],
"optional": [
"any"
]
}
},
"to": [
{
"shell_command": "/usr/local/bin/yabai -m window --focus south"
}
]
},
{
"type": "basic",
"from": {
"key_code": "k",
"modifiers": {
"mandatory": [
"left_shift",
"left_command",
"left_control",
"left_option"
],
"optional": [
"any"
]
}
},
"to": [
{
"shell_command": "/usr/local/bin/yabai -m window --focus north"
}
]
}
]
}
]
}
配置文件位置
nvim ~/.config/karabiner/karabiner.json
参考
https://www.163.com/dy/article/EP9PPA7S0531A225.html