您当前的位置: 首页 >  macos

鼠标macOS下定义快捷键(各品牌通用)

发布时间:2021-11-07 22:46:18 ,浏览量:7

雷蛇鼠标在驱动在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 的强大且稳定的键盘定制器。

设置鼠标

示例1 设置成a,b键


如上图,我把侧面按键设置成a和b。


这样鼠标侧面按键就成a和b 了。

示例2 设置成左右键

示例3 切换macOS虚拟桌面

显然上面的单键映射无法满足我,我需要使用鼠标左侧的按键来切换虚拟桌面。如何实现呢?




微调配置

这个配置可能不完全符合我们的要求,如何来修改呢?

可以直接去修改这个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

关注
打赏
查看更多评论

暂无认证

  • 7浏览

    0关注

    115983博文

    0收益

  • 0浏览

    0点赞

    0打赏

    0留言

私信
关注
热门博文
立即登录/注册

微信扫码登录