mac映射鼠标按键4,5为CTRL+C,CTRL+V
我是程序员,我经常从百度复制粘贴代码到自己项目代码里面。mac下面,借助karabiner软件,我们可以重新映射鼠标按键。如果你不改映射,那么默认的鼠标按键4,5,是前进和后退。但是你改完了之后,它就是CTRL+C和CTRL+V了。
先安装软件,这个简单,然后重启,完成基础的授权,在系统设置,安全里面,允许监控输入。然后导入官方复杂设置中 #mouse_button 的案例。导入完了,启用其中一个,然后你修改配置文件~/.config/karabiner/karabiner.json
我把 "pointing_button": "button4" 修改为: "key_code": "v", "modifiers": "left_command"
把 "pointing_button": "button5" 修改为: "key_code": "c", "modifiers": "left_command"
不同的鼠标可能配置需要调整。
如果下面的配置不灵,你可能需要改一下 left_command, 换成left_control
软件下载地址:
https://github.com/pqrs-org/Karabiner-Elements
完整代码示例如下
{
"global": {
"check_for_updates_on_startup": true,
"show_in_menu_bar": true,
"show_profile_name_in_menu_bar": false
},
"profiles": [
{
"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": [
{
"description": "Change button4,5 to ctrl+C,ctrl+V (rev 1)",
"manipulators": [
{
"conditions": [
{
"keyboard_types": [
"ansi",
"iso"
],
"type": "keyboard_type_if"
}
],
"from": {
"modifiers": {
"optional": [
"caps_lock"
]
},
"pointing_button": "button4"
},
"to": [
{
"key_code": "v",
"modifiers": "left_command"
}
],
"type": "basic"
},
{
"conditions": [
{
"keyboard_types": [
"jis"
],
"type": "keyboard_type_if"
}
],
"from": {
"modifiers": {
"optional": [
"caps_lock"
]
},
"pointing_button": "button4"
},
"to": [
{
"key_code": "v",
"modifiers": "left_command"
}
],
"type": "basic"
},
{
"conditions": [
{
"keyboard_types": [
"ansi",
"iso"
],
"type": "keyboard_type_if"
}
],
"from": {
"modifiers": {
"optional": [
"caps_lock"
]
},
"pointing_button": "button5"
},
"to": [
{
"key_code": "c",
"modifiers": "left_command"
}
],
"type": "basic"
},
{
"conditions": [
{
"keyboard_types": [
"jis"
],
"type": "keyboard_type_if"
}
],
"from": {
"modifiers": {
"optional": [
"caps_lock"
]
},
"pointing_button": "button5"
},
"to": [
{
"key_code": "c",
"modifiers": "left_command"
}
],
"type": "basic"
}
]
}
]
},
"devices": [
{
"disable_built_in_keyboard_if_exists": false,
"fn_function_keys": [],
"identifiers": {
"is_keyboard": true,
"is_pointing_device": false,
"product_id": 641,
"vendor_id": 1452
},
"ignore": true,
"manipulate_caps_lock_led": true,
"simple_modifications": []
},
{
"disable_built_in_keyboard_if_exists": false,
"fn_function_keys": [],
"identifiers": {
"is_keyboard": false,
"is_pointing_device": true,
"product_id": 34328,
"vendor_id": 44580
},
"ignore": false,
"manipulate_caps_lock_led": false,
"simple_modifications": []
}
],
"fn_function_keys": [
{
"from": {
"key_code": "f1"
},
"to": [
{
"consumer_key_code": "display_brightness_decrement"
}
]
},
{
"from": {
"key_code": "f2"
},
"to": [
{
"consumer_key_code": "display_brightness_increment"
}
]
},
{
"from": {
"key_code": "f3"
},
"to": [
{
"apple_vendor_keyboard_key_code": "mission_control"
}
]
},
{
"from": {
"key_code": "f4"
},
"to": [
{
"apple_vendor_keyboard_key_code": "spotlight"
}
]
},
{
"from": {
"key_code": "f5"
},
"to": [
{
"consumer_key_code": "dictation"
}
]
},
{
"from": {
"key_code": "f6"
},
"to": [
{
"key_code": "f6"
}
]
},
{
"from": {
"key_code": "f7"
},
"to": [
{
"consumer_key_code": "rewind"
}
]
},
{
"from": {
"key_code": "f8"
},
"to": [
{
"consumer_key_code": "play_or_pause"
}
]
},
{
"from": {
"key_code": "f9"
},
"to": [
{
"consumer_key_code": "fast_forward"
}
]
},
{
"from": {
"key_code": "f10"
},
"to": [
{
"consumer_key_code": "mute"
}
]
},
{
"from": {
"key_code": "f11"
},
"to": [
{
"consumer_key_code": "volume_decrement"
}
]
},
{
"from": {
"key_code": "f12"
},
"to": [
{
"consumer_key_code": "volume_increment"
}
]
}
],
"name": "Default profile",
"parameters": {
"delay_milliseconds_before_open_device": 1000
},
"selected": true,
"simple_modifications": [],
"virtual_hid_keyboard": {
"country_code": 0,
"indicate_sticky_modifier_keys_state": true,
"mouse_key_xy_scale": 100
}
}
]
}
分类: 默认 标签: 发布于: 2022-02-19 06:54:32, 更新于: 2022-06-19 11:13:46