Powertoys: Keyboard Manager null key conflict with WSL

Created on 18 Aug 2020  ·  8Comments  ·  Source: microsoft/PowerToys

ℹ Computer information

  • PowerToys version: 0.20.1
  • PowerToy Utility: Keyboard Manager
  • Running PowerToys as Admin: No
  • Windows build number: 1909

📝 Provide detailed reproduction steps (if any)

Map shortcut:
Ctrl(left)+P -> Up -> All Apps

✔️ Expected result

_What is the expected result of the above steps?_
When Ctrl+P is pressed, Upkey must be input

❌ Actual result

_What is the actual result of the above steps?_
When Ctrl+P is pressed Upkey is input correctly.
However issue is that it is followed by a spurious Ctrl+Spacealso that I did not enter anywhere.

Verified this by doing showkey under wsl - pressing Ctrl+Pgenerated the following output, where the first part is Upkey (^[[A) and this is followed by Ctrl+Space (^@)

$ showkey -a

Press any keys - Ctrl-D will terminate this program

^[[A     27 0033 0x1b
         91 0133 0x5b
         65 0101 0x41
^@        0 0000 0x00

📷 Screenshots

_Are there any useful screenshots? WinKey+Shift+S and then just paste them directly into the form_
image

Issue-Bug Product-Keyboard Shortcut Manager Resolution-Fix-Committed

All 8 comments

Hi @damnskippy, I can't repro this behaviour, even when I checked my key history with the same mapping. Is this the only mapping you have? Can you share all your active mappings

@saahmedm,
Yes, this is the only single mapping I have and need - and unfortunately it is not working correctly for some reason.
I'm truly puzzled why I'm seeing this and you're not able to repro. Is there any log or something I can collect?
Thanks for looking.

FWIW, I'm primarily using shortcut in windows terminal app if that matters.
However I tested this in cmd.exe and powershell through showkey command and saw in all cases a spurious ^@ entered after the Up key. I don't have any other apps intercepting keys. Strange.

@damnskippy as part of our shortcut remap logic we send a null key (key code 0x255). It seems to be that the showkey command in WSL shows that as ^@ i.e. NULL byte. So it isn't actually inserting Ctrl+Space, we are inserting a null key. This is required to prevent certain unexpected behaviors related to releasing modifiers. What is "end-user" effect you are facing from this, apart from it appearing in showkey?
I tried the above remapping in Terminal and it worked as expected for Powershell, cmd and ubuntu (assuming the expected behavior was to show the previous typed command).

@arjunbalgovind
The real issue I ran into is that I have Ctrl+Space set as my tmux prefix key.
What happened is that after I set up the shortcut map in Keyboard Manager Ctrl(left)+P -> Up -> All Apps, every time I pressed Ctrl+P, this not only input Up key but also tmux prefix was also invoked, which then I have to explicitly get out of. This really made my only shortcut mapping unusable. So I have unmapped it for the moment. But this is what made me even notice this issue in the first place. Thanks.

Since WT now natively supports a way to bind key sequences, I no longer need this. Since no one else is seeing this issue, I will close it.

@crutkas @saahmedm adding this to the milestone as it gets fixed with #7143 which also fixes #6849

Was this page helpful?
0 / 5 - 0 ratings