Mac上的大部分軟件對外置USB鍵盤支持都是不錯的,可是也有一些軟件比較偷懶,好比我最近碰到的一個軟件就是根本不支持小鍵盤輸入數字,而用大鍵盤上的數字鍵卻是沒有問題,實在是奇葩。html
奇葩歸奇葩,問題終究仍是要解決的。稍微研究了一下這個問題,發現能夠用Karabiner這個軟件來對鍵盤進行映射。對於個人需求,就是把小鍵盤上的數字鍵映射成大鍵盤上的數字鍵。實現起來不怎麼難,先上我修改的private.xml文件內容吧:git
<?xml version="1.0"?> <root> <item> <name>Change KeyPad 0 to Num 0</name> <identifier>private.change_keypad0_to_num0</identifier> <autogen>__KeyToKey__ KeyCode::KEYPAD_0, KeyCode::KEY_0</autogen> </item> <item> <name>Change KeyPad 1 to Num 1</name> <identifier>private.change_keypad1_to_num1</identifier> <autogen>__KeyToKey__ KeyCode::KEYPAD_1, KeyCode::KEY_1</autogen> </item> <item> <name>Change KeyPad 2 to Num 2</name> <identifier>private.change_keypad2_to_num2</identifier> <autogen>__KeyToKey__ KeyCode::KEYPAD_2, KeyCode::KEY_2</autogen> </item> <item> <name>Change KeyPad 3 to Num 3</name> <identifier>private.change_keypad3_to_num3</identifier> <autogen>__KeyToKey__ KeyCode::KEYPAD_3, KeyCode::KEY_3</autogen> </item> <item> <name>Change KeyPad 4 to Num 4</name> <identifier>private.change_keypad4_to_num4</identifier> <autogen>__KeyToKey__ KeyCode::KEYPAD_4, KeyCode::KEY_4</autogen> </item> <item> <name>Change KeyPad 5 to Num 5</name> <identifier>private.change_keypad5_to_num5</identifier> <autogen>__KeyToKey__ KeyCode::KEYPAD_5, KeyCode::KEY_5</autogen> </item> <item> <name>Change KeyPad 6 to Num 6</name> <identifier>private.change_keypad6_to_num6</identifier> <autogen>__KeyToKey__ KeyCode::KEYPAD_6, KeyCode::KEY_6</autogen> </item> <item> <name>Change KeyPad 7 to Num 7</name> <identifier>private.change_keypad7_to_num7</identifier> <autogen>__KeyToKey__ KeyCode::KEYPAD_7, KeyCode::KEY_7</autogen> </item> <item> <name>Change KeyPad 8 to Num 8</name> <identifier>private.change_keypad8_to_num8</identifier> <autogen>__KeyToKey__ KeyCode::KEYPAD_8, KeyCode::KEY_8</autogen> </item> <item> <name>Change KeyPad 9 to Num 9</name> <identifier>private.change_keypad9_to_num9</identifier> <autogen>__KeyToKey__ KeyCode::KEYPAD_9, KeyCode::KEY_9</autogen> </item> <item> <name>Change KeyPad Enter to Return</name> <identifier>private.change_keypadEnter_to_return</identifier> <autogen>__KeyToKey__ KeyCode::ENTER, KeyCode::RETURN</autogen> </item> </root>
修改xml文件參考瞭如下兩個網頁:github
How to add your own settings: https://pqrs.org/osx/karabiner/document.html.en#privatexml
private.xml參考手冊: https://pqrs.org/osx/karabiner/xml.html.enide
我是怎麼找各個鍵的鍵值的?工具
這能夠經過Karabiner菜單上的"Launch EventViewer"工具來解決,在這個工具裏,你每按一個鍵都會顯示鍵值的。code
Karabiner是日本人開發的開源軟件,仍是蠻強大的,自己就自帶了許多映射功能。若是你須要的話,能夠對鍵盤上的任意一個鍵進行映射。
xml
軟件主頁:https://pqrs.org/osx/karabiner/index.html.en
htm
Github主頁:https://github.com/tekezo/Karabiner
開發