In karabiner, how do I set left option to \?
-
02-10-2020 - |
Question
I want to map left_option to \, left command to / and right command to | when used alone. When used in combination with other keys I want the left_option, left command and right command to retain their functions. How do I do that?
Solution
<?xml version="1.0"?>
<root>
<item>
<name>L⌥→\&L⌘→/&R⌘→|</name>
<identifier>alttobackslashcmdtoslashandpipe</identifier>
<autogen>
__KeyToKey__
KeyCode::OPTION_L | ModifierFlag::NONE,
KeyCode::BACKSLASH
</autogen>
<autogen>
__KeyToKey__
KeyCode::COMMAND_L | ModifierFlag::NONE,
KeyCode::SLASH
</autogen>
<autogen>
__KeyToKey__
KeyCode::COMMAND_R | ModifierFlag::NONE,
KeyCode::BACKSLASH | ModifierFlag::SHIFT
</autogen>
</item>
</root>
This might not have quite the effect you want, but it's as close as I know how to do.
OTHER TIPS
With the kind help of Takayama Fumihiko, I was able to get it right for Norwegian layouts:
<item>
<appendix>Remap OptionL to Backslash</appendix>
<identifier>private.option_to_backslash</identifier>
<autogen>
__KeyOverlaidModifier__
KeyCode::OPTION_L, ModifierFlag::OPTION_L | ModifierFlag::NONE,
KeyCode::OPTION_L, ModifierFlag::OPTION_L,
KeyCode::KEY_7, ModifierFlag::SHIFT_R | ModifierFlag::OPTION_L,
</autogen>
</item>
<item>
<appendix>Remap CommandL to Slash</appendix>
<identifier>private.option_to_slash</identifier>
<autogen>
__KeyOverlaidModifier__
KeyCode::COMMAND_L, ModifierFlag::COMMAND_L | ModifierFlag::NONE,
KeyCode::COMMAND_L, ModifierFlag::COMMAND_L,
KeyCode::KEY_7, ModifierFlag::SHIFT_R | ModifierFlag::NONE,
</autogen>
</item>
<item>
<appendix>Remap CommandR to Pipe</appendix>
<identifier>private.commandr_to_pipe</identifier>
<autogen>
__KeyOverlaidModifier__
KeyCode::COMMAND_R, ModifierFlag::COMMAND_R | ModifierFlag::NONE,
KeyCode::COMMAND_R, ModifierFlag::COMMAND_R,
KeyCode::KEY_7, ModifierFlag::OPTION_R | ModifierFlag::NONE,
</autogen>
</item>
<item>
<appendix>Remap OptionR to Tilde</appendix>
<identifier>private.optionr_to_tilde</identifier>
<autogen>
__KeyOverlaidModifier__
KeyCode::OPTION_R, ModifierFlag::OPTION_R | ModifierFlag::NONE,
KeyCode::OPTION_R, ModifierFlag::OPTION_R,
KeyCode::BRACKET_RIGHT, ModifierFlag::OPTION_R | ModifierFlag::NONE,
</autogen>
</item>
Licensed under: CC-BY-SA with attribution
Not affiliated with apple.stackexchange