pqrs-org / Karabiner-archived

Karabiner (KeyRemap4MacBook) is a powerful utility for keyboard customization.
https://pqrs.org/osx/karabiner/
The Unlicense
3.82k stars 309 forks source link

Change keys in number pad to arrows #827

Closed ivnsch closed 7 years ago

ivnsch commented 7 years ago

My right arrow and down arrow keys are broken and I wanted to repurpose the 6 and 2 keys in the number pad as replacement. How do I do this? The mappings seem to be very specific, it doesn't seem possible to just say "make key A do B".

dunkarooftop commented 7 years ago
<item>
  <name>Change Num to Arrow</name>
  <appendix>Change NumPad 6 and 2 to Up and Down</appendix>
  <identifier>private.change.num.pad.to.up.and.down</identifier>
  <autogen>
    __KeyToKey__
    KeyCode::KEYPAD_6, 
    KeyCode::CURSOR_UP, 
  </autogen>
  <autogen>
    __KeyToKey__
    KeyCode::KEYPAD_2, 
    KeyCode::CURSOR_DOWN, 
  </autogen>
</item>

It's very easy to do, if you have any more question you can check out the doc. https://pqrs.org/osx/karabiner/xml.html.en Scroll down to "autogen syntax" section and take a look at the __KeyToKey__ section.

Here is an example that Num 6 and 2 only turn to arrow when "Left CMD" is held down too.

<item>
  <name>Change Num to Arrow</name>
  <appendix>Change NumPad 6 and 2 to Up and Down</appendix>
  <identifier>private.change.num.pad.plus.left.cmd.to.up.and.down</identifier>
  <autogen>
    __KeyToKey__
    KeyCode::KEYPAD_6,  ModifierFlag::COMMAND_L | ModifierFlag::NONE,
    KeyCode::CURSOR_UP, 
  </autogen>
  <autogen>
    __KeyToKey__
    KeyCode::KEYPAD_2, ModifierFlag::COMMAND_L | ModifierFlag::NONE,
    KeyCode::CURSOR_DOWN, 
  </autogen>
</item>

BTW you can find all the keycode here https://github.com/tekezo/Karabiner/blob/master/src/bridge/generator/keycode/data/KeyCode.data

If you have any more question let me know.

dunkarooftop commented 7 years ago

There are also many option when it come to arrow key function. You can have Fnor any of the modifier like CMD plus A, W, S, D for the arrow

or When tap left CMD for UP and tap right CMD for DOWN (They still act as CMD when hold with other keys.

or Shift + Left = UP and SHIFT + RIGHT = DOWN

or even When F, D pressed at the same time = DOWN and S, D pressed at the same time = UP (This way your finger won't even need to move away from home row)

Take a look at the doc see what's possible

ivnsch commented 7 years ago

You have some very nice documentation. Thanks for the examples! I only need the first one. I added and enabled it, however it doesn't seem to be working, I still get 6 and 2. What am I missing?

screen shot 2017-03-28 at 11 36 02

<?xml version="1.0"?>
<root>
    <item>
        <name>Change Num to Arrow</name>
        <appendix>Change NumPad 6 and 2 to Up and Down</appendix>
        <identifier>private.change.num.pad.to.up.and.down</identifier>
        <autogen>
            __KeyToKey__
            KeyCode::KEYPAD_6,
            KeyCode::CURSOR_UP,
        </autogen>
        <autogen>
            __KeyToKey__
            KeyCode::KEYPAD_2,
            KeyCode::CURSOR_DOWN, 
        </autogen>
    </item>
</root>
dunkarooftop commented 7 years ago

Go to the last page of Karabiner and open "Launch Event Viewer". Press the 6 and 2 to see what keycode they send to the OS and replace the autogen. I though they would be KEYPAD_6, and KEYPAD_2, but looks like not. (Don't forget to reload the XML after edit)

also I am just a volunteer, the doc is written by @tekezo

ivnsch commented 7 years ago

I actually did that before but couldn't find the problem:

screen shot 2017-03-28 at 20 42 56

dunkarooftop commented 7 years ago

I guess you are using macOS Seirra. Which is not support by Karabiner. Check out Karabiner-Element that one is for Sierra. Limited function but can do what you needed.

ivnsch commented 7 years ago

Thanks! With Karabiner-Element it works. I also was able to do this using only the UI there.