MLA22LL

将普通的PC键盘、机械键盘等,映射成为 Mac键盘布局
Automator > Service > Launch Application > no input > Keyboard > Shortcuts >Services

一、下载软件

Karabiner:键盘映射 [https://pqrs.org/osx/karabiner/index.html.en]

二、苹果键位参考

MB110CH

三、常用设置

  • 对调 Command 与 Option

    在”Change Command_L Key (Left Command)”下面选择”Command_L to Option_L”
    在”Change Command_L Key (Left Command)”下面选择”Command_L to Option_L”

  • PrintScreen 设为 Eject

  • NumLock 设为 Command+Delete 一键删除文件(mac上NumLock没用,DAS键盘对应的就是Clear键)

  • Insert 设为 FN

  • FN键盘
    • f1-f3 控制亮度
    • f2 mission control
    • f4 launchpad
    • f5-f6 键盘背光
    • f7-f9 媒体控制
    • f10-f12 音量控制

四、保存自己的配置

  • 找到配置文件,点Open private.xml
    Open private

  • 找到并修改键盘对应的vendor id和product id
    ID

  • 在EventViewer里面点Main标签,按下A键,misc一栏里就可查看要修改键位代码。
    键位代码

  • 要实现A和B两个键互换,语法是

    1
    2
    <autogen> __KeyToKey__ KeyCode::A, KeyCode::B </autogen>
    <autogen> __KeyToKey__ KeyCode::B, KeyCode::A </autogen>
  • 设置为组合键

    1
    <autogen> __KeyToKey__ KeyCode::A, ModifierFlag::MOD, KeyCode::B, ModifierFlag::MOD</autogen>

五、载入文件

  • Reload XML,选中自定义配置就OK了。
    载入

六、为F1、F2、……F9 设置快捷键

七、其他

特殊情况下,设置键盘快捷键会出现问题,运行以下命令可修复:
rm ~/Library/Preferences/com.apple.symbolichotkeys.plist

  • 根据自己键盘设置的:private.xml
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
<?xml version="1.0"?>
<root>
<devicevendordef>
<vendorname>Logitech</vendorname>
<vendorid>0x046d</vendorid>
</devicevendordef>

<deviceproductdef>
<productname>USB Receiver</productname>
<productid>0xc52b</productid>
</deviceproductdef>

<item>
<name>Logictech</name>
<identifier>private.deviceproductdef</identifier>
<device_only>DeviceVendor::Logitech, DeviceProduct::USB Receiver</device_only>
<identifier>private.remap.pc_to_mac</identifier>
<autogen>__KeyToKey__ KeyCode::HELP, KeyCode::FN</autogen>
<!-- <autogen>__KeyToKey__ KeyCode::PC_APPLICATION, KeyCode::FN</autogen> -->
<autogen>__KeyToKey__ KeyCode::COMMAND_L, KeyCode::OPTION_L</autogen>
<autogen>__KeyToKey__ KeyCode::COMMAND_R, KeyCode::OPTION_R</autogen>
<autogen>__KeyToKey__ KeyCode::OPTION_L, KeyCode::COMMAND_L</autogen>
<autogen>__KeyToKey__ KeyCode::OPTION_R, KeyCode::COMMAND_R</autogen>



<autogen>__KeyToKey__ KeyCode::F1, KeyCode::F11</autogen>
<autogen>__KeyToKey__ KeyCode::F2, KeyCode::F2, ModifierFlag::SHIFT_L, ModifierFlag::COMMAND_L</autogen>
<autogen>__KeyToKey__ KeyCode::F4, KeyCode::F4, ModifierFlag::SHIFT_L, ModifierFlag::COMMAND_L</autogen>
<autogen>__KeyToKey__ KeyCode::F5, KeyCode::EXPOSE_ALL</autogen>
<autogen>__KeyToKey__ KeyCode::F6, KeyCode::F6, ModifierFlag::SHIFT_L, ModifierFlag::COMMAND_L</autogen>
<autogen>__KeyToKey__ KeyCode::F7, KeyCode::D, ModifierFlag::COMMAND_L, ModifierFlag::OPTION_L</autogen>
<!-- <autogen>__KeyToKey__ KeyCode::F8, ConsumerKeyCode::MUSIC_PLAY</autogen> -->
<autogen>__KeyToKey__ KeyCode::F9, ConsumerKeyCode::EJECT, ModifierFlag::CONTROL_L, ModifierFlag::SHIFT_L</autogen>
<autogen>__KeyToKey__ KeyCode::F10, ConsumerKeyCode::POWER, ModifierFlag::COMMAND_L, ModifierFlag::OPTION_L</autogen>
<autogen>__KeyToKey__ KeyCode::F11, ConsumerKeyCode::EJECT, ModifierFlag::COMMAND_L, ModifierFlag::OPTION_L</autogen>
<!-- <autogen>__KeyToKey__ KeyCode::F12, ConsumerKeyCode::VOLUME_UP</autogen> -->

<autogen>__KeyToKey__ KeyCode::KEYPAD_CLEAR, KeyCode::DELETE, ModifierFlag::COMMAND_L</autogen>
<autogen>__KeyToKey__ KeyCode::PC_PRINTSCREEN, ConsumerKeyCode::EJECT</autogen>
</item>
</root>

本文参考:

  1. [键盘] 还在纠结Mac版键盘?试试KeyRemap4MacBook吧![http://www.chiphell.com/thread-678136-1-1.html]
  2. 任意PC键盘映射到MAC键盘的karabiner配置xml文件[http://lonestone.iteye.com/blog/215∏7692]
  3. 官方文档:[https://pqrs.org/osx/karabiner/document.html.en]