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

Russian keyboard needs extra options #832

Open ethaniel opened 7 years ago

ethaniel commented 7 years ago

Hello!

I am a PC user. I find it very confusing on Mac, that when I need to type a dot (.) or a comma (,), I have to press Shift-7 and Shift-6 respectively when switched to the russian keyspace.

Here's how the russian keyboard works on Mac: image

Here's how the russian keyboard works on PC: image

  1. We have the dot and the comma on the Mac's /? button (the one to the left of the right Shift).
  2. We have Shift-6 for Colon (:) and Shift-7 For question mark (?).

Perhaps you could consider adding an option for russian keyboards where the whole top number row would work as a PC keyboard when Shift is clicked? And also move the dot/comma to the bottom row (to the left of the right Shift)?

dunkarooftop commented 7 years ago

Here is one idea/quick fix for your problem by using the Dual Role Key When you tap Left SHIFT it will send . by SHIFT+7 , but when you held it with other key it will act as SHIFT When you tap Right SHIFT will send ,

<item>
  <name>Dual Role Keys For SHIFT key</name>
  <identifier>private.dual.role.keys.for.shift.key</identifier>
    <autogen>
      __KeyOverlaidModifier__
      KeyCode::SHIFT_L, ModifierFlag::NONE <!-- This limited when only SHIFT is pressed alone -->
      KeyCode::SHIFT_L,
      KeyCode::KEY_7, ModifierFlag::SHIFT_L, <!-- This is should send "." -->
    </autogen>

    <autogen>
      __KeyOverlaidModifier__
      KeyCode::SHIFT_R, ModifierFlag::NONE
      KeyCode::SHIFT_R,
      KeyCode::KEY_6, ModifierFlag::SHIFT_L, <!-- This is should send "," -->
    </autogen>
</item>

Add it to your private.xml, more about how to customize to your own need you can take a look at the documents here https://pqrs.org/osx/karabiner/xml.html.en

I don't have Russian keyboard can't help you. Let me know if you have any problem with private.xml I will see what I can do. :)

ethaniel commented 7 years ago

I think I explained it wrong :) I'm trying to say is that it would be awesome to port the russian PC keyboard to Mac.

Combination letter
Shift - 1 ! (mac already does this)
Shift - 2 " (mac already does this)
Shift - 3 № (mac already does this)
Shift - 4 ;
Shift - 5 %
Shift - 6 :
Shift - 7 ?
Shift - 8 *
Shift - 9 ( (mac already does this)
Shift - 0 ) (mac already does this)

And for the bottom right button:

Combination letter
/ .
? (Shift - /) ,
dunkarooftop commented 7 years ago

Here is the code for your private.xml It's very simple KeyToKey refer to doc if you wanna learn more. I am having trouble convert SHIFT+7 and 8 not sure which key to use (I never seen a Russian keyboard before, not sure how it work) . Please modify the ???

also at the last page of Karabiner there is event viewer to help you see the keycode that you are pressing.

<item>
  <name>Russian MAC to PC layout</name>
    <identifier>private.russian.mac.to.pc.layout</identifier>
      <autogen>
        __KeyToKey__ 
        KeyCode::4, MODIFIERFLAG_EITHER_LEFT_OR_RIGHT_SHIFT,

        KeyCode::8, ModifierFlag::SHIFT_L,
      </autogen>
      <autogen>
        __KeyToKey__ 
        KeyCode::5, MODIFIERFLAG_EITHER_LEFT_OR_RIGHT_SHIFT,

        KeyCode::4, ModifierFlag::SHIFT_L,
      </autogen>
      <autogen>
        __KeyToKey__ 
        KeyCode::6, MODIFIERFLAG_EITHER_LEFT_OR_RIGHT_SHIFT,

        KeyCode::5, ModifierFlag::SHIFT_L,
      </autogen>
      <autogen>
        __KeyToKey__ 
        KeyCode::7, MODIFIERFLAG_EITHER_LEFT_OR_RIGHT_SHIFT,

        KeyCode::???, ModifierFlag::SHIFT_L,
      </autogen>
      <autogen>
        __KeyToKey__ 
        KeyCode::8, MODIFIERFLAG_EITHER_LEFT_OR_RIGHT_SHIFT,

        KeyCode::???, ModifierFlag::SHIFT_L,
      </autogen>

      <autogen>
        __KeyToKey__ 
        KeyCode::SLASH,

        KeyCode::DOT,
      </autogen>
      <autogen>
        __KeyToKey__ 
        KeyCode::SLASH, MODIFIERFLAG_EITHER_LEFT_OR_RIGHT_SHIFT,

        KeyCode::COMMA,
      </autogen>
</item>

Let me know if it work cheers

dunkarooftop commented 7 years ago

You also might need to add Filter: Specify input source in your setting, search the doc for Filter: Specify input source for more detials

Might look something like this. (it's my guess, please read the doc and find correct setting) This limited the tweak only apply when you are in Russian mode

add this under <root>

  <inputsourcedef>
    <name>MY_RUSSIAN</name>
    <inputsourceid_prefix>com.apple.keylayout.Russian</inputsourceid_prefix>
  </inputsourcedef>

add this under <item> <inputsource_only>MY_RUSSIAN</inputsource_only>

ethaniel commented 7 years ago

@dunkarooftop Thank you! With your help, I managed to complete the code. Here is the full russian PC keyboard layout on Mac:

<?xml version="1.0"?>
<root>
<inputsourcedef>
<name>MY_RUSSIAN</name>
<inputsourceid_prefix>com.apple.keylayout.Russian</inputsourceid_prefix>
</inputsourcedef>

<item>

    <inputsource_only>MY_RUSSIAN</inputsource_only>

  <name>Russian MAC to PC layout</name>
    <identifier>private.russian.mac.to.pc.layout</identifier>
      <autogen>
        __KeyToKey__ 
        KeyCode::4, MODIFIERFLAG_EITHER_LEFT_OR_RIGHT_SHIFT,

        KeyCode::8, ModifierFlag::SHIFT_L,
      </autogen>
      <autogen>
        __KeyToKey__ 
        KeyCode::5, MODIFIERFLAG_EITHER_LEFT_OR_RIGHT_SHIFT,

        KeyCode::4, ModifierFlag::SHIFT_L,
      </autogen>
      <autogen>
        __KeyToKey__ 
        KeyCode::6, MODIFIERFLAG_EITHER_LEFT_OR_RIGHT_SHIFT,

        KeyCode::5, ModifierFlag::SHIFT_L,
      </autogen>
      <autogen>
        __KeyToKey__ 
        KeyCode::7, MODIFIERFLAG_EITHER_LEFT_OR_RIGHT_SHIFT,

        KeyCode::SLASH, ModifierFlag::SHIFT_L,
      </autogen>
      <autogen>
        __KeyToKey__ 
        KeyCode::8, MODIFIERFLAG_EITHER_LEFT_OR_RIGHT_SHIFT,

        KeyCode::KEYPAD_MULTIPLY,
      </autogen>

      <autogen>
        __KeyToKey__ 
        KeyCode::SLASH, MODIFIERFLAG_EITHER_LEFT_OR_RIGHT_SHIFT,

        KeyCode::6, ModifierFlag::SHIFT_L,
      </autogen>

      <autogen>
        __KeyToKey__ 
        KeyCode::SLASH,

        KeyCode::7, ModifierFlag::SHIFT_L,
      </autogen>

      <autogen>
        __KeyToKey__ 
        KeyCode::RUSSIAN_TILDE,

        KeyCode::BACKSLASH,
      </autogen>

</item>

</root>
dunkarooftop commented 7 years ago

Awesome :)

berpcor commented 7 years ago

Hello. Can you add ethaniel's settings to https://pqrs.org/osx/karabiner/complex_modifications/ ? It is very important fix for Russians. It seems that now it is impossible to edit private.xml.