pqrs-org / Karabiner-Elements

Karabiner-Elements is a powerful utility for keyboard customization on macOS Sierra (10.12) or later.
https://pqrs.org/osx/karabiner/
The Unlicense
18.69k stars 836 forks source link

Home and End Buttons sending different signals on Keypress - How to fix #3563

Open kc2npu opened 1 year ago

kc2npu commented 1 year ago

Discussed in https://github.com/pqrs-org/Karabiner-Elements/discussions/3561

Originally posted by **kc2npu** July 26, 2023 I am new to this and found an article online that mentioned that Karabiner as a potential tool that I can use to resolve my situation. I use Microsoft Remote Desktop on my MacBook Pro (Ventura 13.5) to access my office desktop (Windows 10 Pro Education 22H2) via our VPN. If I use Apple's Magic Keyboard the Home and End keys on the keyboard function as expected - moving the cursor to the start or end of the current line in Windows. However, if I use the Rii RK801 Wireless Bluetooth Keyboard with the laptop and press the Home or End keys it docks the window I am working on to the left (home) or right (end) of the screen and shows me other windows which can be tiled on the other half of the screen. Using the KeyCodes app and the Karabiner-EventViewer, it was determined that the keyboards are sending different signals for the keypresses: | Key Pressed | Apple MagicKeyboard | Rii RK801 Wireless BT | | ----------- | ------------------- | --------------------- | | [HOME] | **KeyCode App**

Unicode: 63273 / 0xf729
Keys: ⬉
Keycode: 115 / 0x73

**Karabiner-EventViewer:**

[
{
"type": "down",
"name": {"key_code":"home"},
"usagePage": "7 (0x0007)",
"usage": "74 (0x004a)",
"misc": ""
},
{
"type": "up",
"name": {"key_code":"home"},
"usagePage": "7 (0x0007)",
"usage": "74 (0x004a)",
"misc": ""
}
]| **KeyCode App**

Unicode: 63234 / 0xf702
Keys: ⌘←
Keycode: 123 / 0x7b

**Karabiner-EventViewer:**

[
{
"type": "down",
"name": {"key_code":"left_command"},
"usagePage": "7 (0x0007)",
"usage": "227 (0x00e3)",
"misc": "flags left_command"
},
{
"type": "down",
"name": {"key_code":"left_arrow"},
"usagePage": "7 (0x0007)",
"usage": "80 (0x0050)",
"misc": "flags left_command"
},
{
"type": "up",
"name": {"key_code":"left_arrow"},
"usagePage": "7 (0x0007)",
"usage": "80 (0x0050)",
"misc": "flags left_command"
},
{
"type": "up",
"name": {"key_code":"left_command"},
"usagePage": "7 (0x0007)",
"usage": "227 (0x00e3)",
"misc": ""
}
]| | [END] | **KeyCode App**

Unicode: 63275 / 0xf72b
Keys: ➘
Keycode: 119 / 0x77

**Karabiner-EventViewer:**

[
{
"type": "down",
"name": {"key_code":"end"},
"usagePage": "7 (0x0007)",
"usage": "77 (0x004d)",
"misc": ""
},
{
"type": "up",
"name": {"key_code":"end"},
"usagePage": "7 (0x0007)",
"usage": "77 (0x004d)",
"misc": ""
},
]| **KeyCode App**
Unicode: 63235 / 0xf703
Keys: ⌘→
Keycode: 124 / 0x7c

**Karabiner-EventViewer:**

[
{
"type": "down",
"name": {"key_code":"left_command"},
"usagePage": "7 (0x0007)",
"usage": "227 (0x00e3)",
"misc": "flags left_command"
},
{
"type": "down",
"name": {"key_code":"right_arrow"},
"usagePage": "7 (0x0007)",
"usage": "79 (0x004f)",
"misc": "flags left_command"
},
{
"type": "up",
"name": {"key_code":"right_arrow"},
"usagePage": "7 (0x0007)",
"usage": "79 (0x004f)",
"misc": "flags left_command"
},
{
"type": "up",
"name": {"key_code":"left_command"},
"usagePage": "7 (0x0007)",
"usage": "227 (0x00e3)",
"misc": ""
}
]| How do I get Karabiner help to "remap" the Rii Keyboard to actually do what the Apple MagicKeyboard sends. Especially since the Rii Keyboard appears to be sending two keypress signals instead of just a single one.
kc2npu commented 1 year ago

I was able to write a json file and put it into the complex_modifications folder to add the following rules

{
"title":"Rii RK801 Wireless BT Keyboard - Change Home and End Keys2",
"rules":[
    {
        "description":"Change HomeKey from LeftCommand+Left Arrow (⌘←)to Home (⬉) v2",
        "manipulators":[
            {
                "type":"basic",
                "from":{
                    "simultaneous":[
                        {"key_code":"left_arrow"},
                        {"key_code":"left_command"}
                    ]
                },
                "to":[
                    {
                        "key_code":"home"
                    }
                ]
            }
        ]
    },
    {
        "description":"Change EndKey from LeftCommand+Right Arrow (⌘→)to End (➘) v2",
        "manipulators":[
            {
                "type":"basic",
                "from":{
                    "simultaneous":[
                        {"key_code":"right_arrow"},
                        {"key_code":"left_command"}
                    ]
                },
                "to":[
                    {
                        "key_code":"end"
                    }
                ]
            }
        ]
    }
]}

RiiKeyboard-HomeEndKey2.json.txt