Skip to content

Instantly share code, notes, and snippets.

@focalintent
Last active November 12, 2015 01:15
Show Gist options
  • Save focalintent/f0a6be9fd675d8b17ad1 to your computer and use it in GitHub Desktop.
Save focalintent/f0a6be9fd675d8b17ad1 to your computer and use it in GitHub Desktop.
Private.xml definition for switching between english/russian input sources depending on which keyboard I'm using. (I may switch this over to the right cmd key so that I can manually switch layouts around, for example, if I want to be able to switch between english/russian easily)
<?xml version="1.0"?>
<!-- private.xml definition for Karabiner - https://pqrs.org/osx/karabiner/index.html.en -->
<root>
<inputsourcedef>
<name>MY_RUSSIAN</name>
<inputsourceid_prefix>com.apple.keylayout.Russian</inputsourceid_prefix>
</inputsourcedef>
<inputsourcedef>
<name>MY_ENGLISH</name>
<inputsourceid_prefix>com.apple.keylayout.US</inputsourceid_prefix>
</inputsourcedef>
<vkchangeinputsourcedef>
<name>KeyCode::VK_CHANGE_INPUTSOURCE_MY_RUSSIAN</name>
<inputsourceid_equal>com.apple.keylayout.Russian</inputsourceid_equal>
</vkchangeinputsourcedef>
<vkchangeinputsourcedef>
<name>KeyCode::VK_CHANGE_INPUTSOURCE_MY_ENGLISH</name>
<inputsourceid_equal>com.apple.keylayout.US</inputsourceid_equal>
</vkchangeinputsourcedef>
<!-- If we're on the russian keyboard, and our input source is currently english, then a tap of the
-- left command key will change the input source to russian, and then left-command goes back to
-- its normal usages -->
<item>
<name>Russian Keyboard Russian Input Source</name>
<identifier>private.my_russian_keyboard_to_russian</identifier>
<inputsource_only>MY_ENGLISH</inputsource_only>
<device_only>DeviceVendor::APPLE_COMPUTER, DeviceProduct::APPLE_WIRELESS_KEYBOARD_0x0256</device_only>
<autogen>
__KeyToKey__
KeyCode::COMMAND_L,
KeyCode::COMMAND_L,
KeyCode::VK_CHANGE_INPUTSOURCE_MY_RUSSIAN
</autogen>
</item>
<!-- If we're on the english keyboard (the magic keyboard in this case), and our input source is
-- currently russian, then a tap of the left command key will change the input source to russian,
-- and then left-command goes back to its normal usages -->
<item>
<name>English Keyboard English Input Source</name>
<identifier>private.my_english_keyboard</identifier>
<inputsource_only>MY_RUSSIAN</inputsource_only>
<device_only>DeviceVendor::Apple_Bluetooth, DeviceProduct::MAGIC_KEYBOARD</device_only>
<autogen>
__KeyToKey__
KeyCode::COMMAND_L,
KeyCode::COMMAND_L,
KeyCode::VK_CHANGE_INPUTSOURCE_MY_ENGLISH
</autogen>
</item>
</root>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment