Takayama Fumihiko | Email: <tekezo@pqrs.org> | Google+

KeyRemap4MacBook

table of contents

Document

Note

This is a documentation for older versions.
[Show the latest document]

How to build from source code.

  1. Install Xcode
  2. Extract Source Code
  3. Type following command in Terminal.app
    $ make clean all
    

How to edit source code.

Sample Diff: add delete2forwarddele

(1) Extract a Source code.

(2) Edit the checkbox.xml file.

  • files/prefpane/checkbox.xml

(3) Generate the header files.

$ cd src/core/kext
$ make

(4) Edit a C++ source code.

  • src/core/kext/remap.cpp

(5) Build kext.

$ cd src/core/kext
$ make

(6) Reload kext. Then, enable the remapping by sysctl command, and test it.

$ cd src/core/kext
$ make reload
$ sudo sysctl -w keyremap4macbook.remap.delete2forwarddelete=1

(7) If test has finished, make a package and install it.

$ make
$ open KeyRemap4MacBook-*.pkg

(8) If installation has finished, close the system preferences panel to update a list of sysctl.

(9) Completed!! Please send a patch to me.

Investigate a key code.

To investigate a key code, turn on debug mode. Type the following command in Terminal.app

sudo sysctl -w keyremap4macbook.debug=1

Then, Type the following command in Terminal.app

sudo tail -f /var/log/system.log

Apr 7 22:34:15 rapeseed kernel[0]: caught hid event type 12 flags 0x0 key 55 charCode 0 charSet 0 origCharCode 0 origCharSet 0 kbdType 37
Apr 7 22:34:15 rapeseed kernel[0]: sending hid event type 12 flags 0x0 key 59 charCode 0 charSet 0 origCharCode 0 origCharSet 0 kbdType 37
*** Type Control-C to quit ***
Date: 2012-05-09 22:07 (UTC)