Powertoys: [Keyboard Manager] Right Alt Gr key stopped working after switching left Ctrl/Alt keys

Created on 22 May 2020  路  13Comments  路  Source: microsoft/PowerToys

Environment

Windows build number: Microsoft Windows [Versione 10.0.18363.836]
PowerToys version: v0.18.0
PowerToy module for which you are reporting the bug: Keyboard Manager

Steps to reproduce


    • Map key Ctrl (left) to Alt (left)


    • Map key Alt (left) to Ctrl (left)


    • Press Alt Gr (Right Alt Key) + Any key (for example @ on Italian Keyboard )

Actual VS Expected behavior

Before the remapping Alt Gr + @ works and output a @ while after the remapping the Right Alt key behaves like a regular Alt Key so the output is . I've even tried to remap Alt (right) + 貌 to Alt (Right)+Ctrl (Right)+貌 but still not working.

Issue-Bug Product-Keyboard Shortcut Manager

Most helpful comment

After digging more into this, it turns out Alt Gr is internally just Ctrl (Left) + Alt (Right) at the virtual key level. When using English US keyboard Alt Gr behaves like a normal Alt (Right), but it changes for other languages. Which is why if you remap Ctrl (Left) it will affect Alt Gr as well. In order to support this particular use case we would have to look into scan code based remaps rather than virtual key code.
@saahmedm what do you think about this issue?

All 13 comments

Possibly related to #3641.

I had the exact same issue when doing exactly the same remap. Updating to v0.18.1 doesn't fix it.

You don't even have to remap any of the Alt keys for PowerToys to break Alt Gr. If you try to just remap Win (Left) to Ctrl (Left) and Ctrl (Left) to Win (Left) then Alt Gr _still breaks_ and you lose the ability to write @ on many international keyboard layouts (along with {. }, [, ] and many more)

If you however only remap Caps Lock, then the Alt Gr is fine and still works.

After digging more into this, it turns out Alt Gr is internally just Ctrl (Left) + Alt (Right) at the virtual key level. When using English US keyboard Alt Gr behaves like a normal Alt (Right), but it changes for other languages. Which is why if you remap Ctrl (Left) it will affect Alt Gr as well. In order to support this particular use case we would have to look into scan code based remaps rather than virtual key code.
@saahmedm what do you think about this issue?

To verify that Alt Gr is actually Ctrl(Left) + Alt (Right) you can try this shortcut on Windows from this guide:

Ctrl + Alt + Tab | Use the arrow keys to switch between all open apps.
-- | --

If you are not using English-US you can invoke this either by Ctrl(L)+Alt(L)+Tab or AltGr+Tab

Hello @arjunbalgovind,

Ctrl + Alt + Tab or AltGr +Tab (without remappings) are indeed working as expected (the tab navigation screen is shown and kept open). In the while I messed up a little. I forced a shortcut remapping with the Alt (left) + Alt (right) key, ignored the warning message about using the same key twice, and saved the configuration. Now the Keyboard Manager stops working every time I try to get into the remapping screens (both single keys and shortcuts), also remapping screens are not showing at all. How can I reset the Keyboard Manager configuration? As soon as I'll be able to reproduce the bug that brought me here I'll open a new ticket with all the steps to reproduce it.

@micc83 I wasn't able to repro this issue.

what happens when you try get to KBM? Does it crash? does it not open when you click?

I'm not sure what happens under the hood. However, when I click on the shortcuts remapping button:

  • The remapping screen doesn't show up
  • The remapping module stops working all together
  • Powertoys Run keeps working
  • The Powertoys icon in the traybar disappears

Hello @arjunbalgovind,

Ctrl + Alt + Tab or AltGr +Tab (without remappings) are indeed working as expected (the tab navigation screen is shown and kept open). In the while I messed up a little. I forced a shortcut remapping with the Alt (left) + Alt (right) key, ignored the warning message about using the same key twice, and saved the configuration. Now the Keyboard Manager stops working every time I try to get into the remapping screens (both single keys and shortcuts), also remapping screens are not showing at all. How can I reset the Keyboard Manager configuration? As soon as I'll be able to reproduce the bug that brought me here I'll open a new ticket with all the steps to reproduce it.

You should be able to reset all your remappings as a quick workaround by deleting C:\Users\Username\AppData\Local\Microsoft\PowerToys\KeyboardManager. This will however delete any keyboard remappings you had saved earlier

@micc83 before you delete that file, can you share a screenshot of the contents of the file? So that we can identify what configuration under the hood was actually causing the crash.

Sure, I was already doint it 馃槃

Ps. Cool you're using json for storing configs... I was expecting some binary...

default.json

{
    "remapKeys": {
        "inProcess": [
            {
                "originalKeys": "20",
                "newRemapKeys": "162"
            },
            {
                "originalKeys": "164",
                "newRemapKeys": "162"
            },
            {
                "originalKeys": "162",
                "newRemapKeys": "164"
            }
        ]
    },
    "remapShortcuts": {
        "global": [
            {
                "originalKeys": "165;192",
                "newRemapKeys": "165;192"
            },
            {
                "originalKeys": "162;9",
                "newRemapKeys": "164;9"
            }
        ]
    }
}

I've reset first the remapShortcuts.global property, the error was still there. I then deleted remapKeys.inProcess and it started working back.

@micc83 Can you create a separate issue for the crash you were facing. It looks like there's definitely some bug, because even if you ignore the warnings,
{ "originalKeys": "165;192", "newRemapKeys": "165;192" },
shouldn't be possible.
Edit:
I was able to reproduce it by doing what you mentioned. It looks like PowerToys crashes.

I read in #3641 that this issue will be considered in v1. For now this easy tweak can solve the issue. I, as a user who is used to the nice location of cmnd key in Mac OSX, wanted to switch Left-Ctrl and Left-Alt with PowerToys. And then, remap the shortcuts (Alt+Tab with Ctrl+Tab) and (Alt+F4 with Ctrl+Q), so that I get exactly the functionality similar to Mac OSX. But doing so, messes up the Right-Alt (Alt Gr) as well. This is a problem specially if your keyboard is not English, thus, you need Alt Gr to type certain characters. The solution was to change ONLY the left Ctrl and left Alt using the registry method (e.g. the method described here). And then, use PowerToys to change the above shortcuts (and not using the Remap functionality). Until a fix from PowerToys, this will resolve the issue.

Was this page helpful?
0 / 5 - 0 ratings

Related issues

verglor picture verglor  路  3Comments

patware picture patware  路  3Comments

amorenew picture amorenew  路  3Comments

seritools picture seritools  路  3Comments

smz picture smz  路  3Comments