Tell me more ×
Super User is a question and answer site for computer enthusiasts and power users. It's 100% free, no registration required.

I bought a cheap Chinese replacement keyboard for my late 2007 MBP. The close square/curly bracket key actually sends a left control signal to the Mac. So I'm trying to remap my backslash/pipe key to be close square/curly bracket but I can't find the key remapping software to do it. Double Command and KeyRemap4Macbook can't do arbitrary key remaps and uControl/fkeys don't work on Snow Leopard. Anyone have ideas? I have no problem editing text config files if necessary.

share|improve this question

4 Answers

up vote 3 down vote accepted

Use Ukelele to create your own keyboard layout.

share|improve this answer

KeyRemap4MacBook also supports adding custom settings in private.xml. See the source for the key code values and predefined settings.

If ] appears as a right control, this might work:

<autogen>__KeyToKey__ KeyCode::CONTROL_R, KeyCode::BRACKET_RIGHT</autogen>

Other examples:

<autogen>__KeyToKey__ KeyCode::TAB, VK_COMMAND | ModifierFlag::NONE, KeyCode::VK_NONE</autogen>
<autogen>__KeyToKey__ KeyCode::F19, KeyCode::COMMAND_L, ModifierFlag::CONTROL_L | ModifierFlag::OPTION_L | ModifierFlag::SHIFT_L | ModifierFlag::COMMAND_L</autogen> <!-- you can change caps lock to F19 with PCKeyboardHack -->
<autogen>__KeyToKey__ KeyCode::F1, VK_CONTROL, KeyCode::VK_CONSUMERKEY_BRIGHTNESS_DOWN</autogen> <!-- for keyboards without the special F-keys -->
<autogen>__KeyToKey__ KeyCode::VK_CONSUMERKEY_VOLUME_UP, ModifierFlag::NONE, KeyCode::VK_CONSUMERKEY_VOLUME_UP, ModifierFlag::OPTION_L | ModifierFlag::SHIFT_L</autogen>
<autogen>__KeyOverlaidModifier__ KeyCode::SHIFT_L, ModifierFlag::SHIFT_L | ModifierFlag::NONE, KeyCode::SHIFT_L, KeyCode::F18</autogen> <!-- pressing left shift to F18 -->
<autogen>__PointingButtonToKey__ PointingButton::BUTTON4, KeyCode::A</autogen>
<autogen>__DoublePressModifier__ KeyCode::SHIFT_L, KeyCode::SHIFT_L, KeyCode::A</autogen>
<autogen>__SimultaneousKeyPresses__ KeyCode::KEY_1, KeyCode::KEY_2, KeyCode::A</autogen>
<autogen>__HoldingKeyToKey__ KeyCode::A, KeyCode::A, KeyCode::VK_NONE, KeyCode::B, Option::NOREPEAT</autogen> <!-- makes a get registered on key down -->
<autogen>__KeyToKey__ KeyCode::KEY_3, KeyCode::VK_CHANGE_INPUTMODE_ENGLISH</autogen>

If you use custom keylayouts:

  • Keyboard layouts in ~/Library/Keyboard Layouts/ can't be selected in password dialogs or the login window but ones in /Library/Keyboard Layouts/ can.
  • The popovers shown when holding keys only work with Ukelele's bundle format and not with normal keylayout files.
  • You can remove the default input methods by editing the HIToolbox plist.

I have posted more notes about using KeyRemap4MacBook and custom keylayouts here.

share|improve this answer
Yeah - I left the close square bracket key as-is and reassigned the backslash/pipe key. As far as the laptop is concerned, the close square bracket key is a physical left control key. – Mason Mar 15 '11 at 13:31

You can try this method of using applescript to map keys differently.

share|improve this answer
It just opens the Keyboard preference pane in system preferences, where the assignment of modifier keys can be changed. That person's problem is that he wants to switch the setting regularly, therefore uses GUI scripting. That dialog is far from "arbitrary key remaps" though. – Daniel Beck Mar 13 '11 at 23:40

KeyRemap4MacBook might be useful as well.

share|improve this answer
My post specifically states that it does not work for what I'm doing. – Mason Mar 15 '11 at 13:30

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.