microsoft / PowerToys

Windows system utilities to maximize productivity
MIT License
110.15k stars 6.49k forks source link

Shortcut remapping sporadically does not work #17344

Open dapal-003 opened 2 years ago

dapal-003 commented 2 years ago

Microsoft PowerToys version

v0.56.2

Running as admin

Area(s) with issue?

Keyboard Manager

Steps to reproduce

Create any shortcut combination that includes a modifier in the mapped key, for example Win + V to CTRL+ALT+V Create another keyboard shortcut that doesn't include a modifier key, for example Win + Space to O Press the shortcuts while in a text editor, allowing of plenty of time between each press of combination

Restarting power toys, turning keyboard remapping on and off and completely re-doing the shortcuts all have a chance to fix the issue. I've not been able to reliably use one method to consistently fix the issue. Sometimes it's required to apply the same "fix" multiple times before it works again. The modifier shortcuts break randomly as far as I am aware.

Debug archive

✔️ Expected Behavior

Powertoys intercepts both shortcut and changes each over to press their new mapped key

❌ Actual Behavior

Powertoys ignores the combination that includes a modifier key in the mapped to and lets the original key combination go through Powertoys intercepts the combination that does not include the Windows key and sends the new mapped key through.

This behavior has shown itself sporadically over the last month, however it's gotten to a point now that turning the manager on and off or restarting power toys no longer fixes the issue.

Other Software

https://github.com/hluk/CopyQ V6.1.0 with the shortcut CTRL+ALT+V to show the latest clipboard This software has been working together with powertoys flawlessly when the keyboard shortcut manager actually works.

TzakShrike commented 2 years ago

I think this is related to simulated keyup events for modifier keys.

I noticed this when mapping a Shift+something to Shift+something else, and the events that ended up being sent resulting in windows 100% consistently thinking that my modifier key was held long after release, which interfered with me sending other shortcuts (or typing, obviously) later.

I found that I could work around the issue by mapping Shift (Left) and Shift (Right) individually, and not using the non-directional Shift at all.

Even in the example that @dapal-003 posted above, this issue doesn't occur if you only map Win (Right) for example in both shortcuts, and ensuring that you release the windows key after each shortcut press. (Edit: This turns out to be not true, this just avoids some bugs, not all)

I was about to create a similar bug report for my issue, but I found this one and think these two are very strongly related.

As a recommended start, don't release the modifier key after sending the target key combination if the same modifier key exists in the source key combination.

@dapal-003 if you end up in this kind of situation, just double-tap the offending modifier key (windows in this case) and your shortcuts should all work again. Can you confirm this, just to be sure?

jaimecbernardo commented 2 years ago

There are definitely some bugs here. Mapped Win (Left)+space to 'o' and Win(Left)+v to Ctrl(Left)+v and it replicates. Unpressing the shortcut and then repressing it seems to fix it for a bit, buy yeah, issue returns after a while. Replicates nicely if I press Win(Left)+v; Win (Left)+space; Win (Left)+space; . The third Win(Left)+space won't work. Win(Left)+v stops working until I totally unpress keys and introduce Win(Left)+ space again.

TzakShrike commented 2 years ago

There's definitely more going on here in addition to what I said earlier. It's as though the program is getting into an inconsistent state.

While we're at it, could whoever looks at modifiers for this also add the LOya (Left Thumb) and ROya (Right Thumb) modifiers?

dapal-003 commented 2 years ago

@dapal-003 if you end up in this kind of situation, just double-tap the offending modifier key (windows in this case) and your shortcuts should all work again. Can you confirm this, just to be sure?

Thanks for getting back to me with the issue, I just tried your suggestion, and sadly it did not fix the issue. Doubletapping win (left or right) did not reset the keyboard manager to its previous state

jaimecbernardo commented 2 years ago

While we're at it, could whoever looks at modifiers for this also add the LOya (Left Thumb) and ROya (Right Thumb) modifiers?

What keys are these? First time I'm hearing of these keys. Perhaps this is a Feature Request?

TzakShrike commented 2 years ago

Yeah it's pretty much a feature request. They're keys specific to a uncommon type of Japanese keyboard, but they have surprisingly good low-level support in Windows (Recently there was a bug in UWP apps that meant they didn't work, but it was patched and now they're fine). Think of them like two additional independent shift-like keys, and the keyboard as the DVORAK of the Japanese language.

Considering we can remap keys, I wanted to utilize them to make way more shortcuts, shortcuts that wouldn't ever conflict with any program. This should work, but PowerToys only recognises standard modifier keys for making shortcuts now.

image

jaimecbernardo commented 2 years ago

Yeah it's pretty much a feature request. They're keys specific to a uncommon type of Japanese keyboard, but they have surprisingly good low-level support in Windows (Recently there was a bug in UWP apps that meant they didn't work, but it was patched and now they're fine). Think of them like two additional independent shift-like keys, and the keyboard as the DVORAK of the Japanese language.

Considering we can remap keys, I wanted to utilize them to make way more shortcuts, shortcuts that wouldn't ever conflict with any program. This should work, but PowerToys only recognises standard modifier keys for making shortcuts now.

image

I see. Is any key reported if you press that key while trying to map a shortcut? Open a separate feature request for this, please.

acomagu commented 2 years ago

Same here. All these shortcuts stop to work randomly. Seems start working after few minutes. image

(Actually I tried another remapper(AHK) in other PC but faced same problem so I guess it may be Windows side bug...)

levilansing commented 2 years ago

I have this issue in 0.57.0. It's hard to repro, but when it happens, it seems like every key used in any keyboard shortcut (and the letter A for some reason) completely stops working for most applications, but not all. Sometimes it happens while I'm typing, other times it happens when I wake up my PC (I do often tap CTRL/ALT/WIN (left) to wake and WIN (left) is mapped to CTRL and used in several shortcuts)

I have a possibly related issue where I have several windows (left) + [key] shortcuts, and if I accidentally type WIN+L (I have the WIN+L lock shortcut disabled in the registry), the win left key gets stuck down for all future key presses until I press and release the OTHER windows key. Sometimes when I get stuck in this state just my shortcuts stop working, other times those keys stop working entirely. may or may not be related because other times when I end up with keys not working I definitely did NOT press WIN+L.

Rebooting is the only guaranteed fix, restarting powertoys, toggling keyboard manager, and even turning the keyboard manager OFF doesn't always fix the keys that stop working. recently, just starting powertoys as administrator (not toggling anything) did fix it.

ghost commented 2 years ago

See my comment at #17788 for a workaround and more info.

jaimecbernardo commented 2 years ago

On 0.59 we did some fixes that might also work here. Could you please give it a try and check if it helps here?

levilansing commented 2 years ago

I upgraded yesterday and experience the issue again today, where the key mappings suddenly stopped working. I opened powertoys as an administrator and they instantly started working again.

dapal-003 commented 2 years ago

Issue is still around. Now even restarting powertoys or turning keyboard manager doesn't restore it's functionality.

maykot commented 8 months ago

I'm experiencing the exact same problem with a few different shortcuts. All of them of the form Ctrl (Left) + Alt (Rigth) + key -> key, e.g. Ctrl (Left) + Alt (Rigth) + ] -> End, Ctrl (Left) + Alt (Rigth) + S -> `, etc.

In all of these cases pressing the destination key directly fixes the issue. So does locking and unlocking Windows.

NathanWailes commented 8 months ago

Not sure how relevant / helpful this will be, but just in case: I was just having an issue where my PowerToys shortcut Win+A/D to map to Win+Left/Right wasn't working. I went to https://www.keyboardtester.com/ and heard a constant "clicking" sound indicating some key was being held down; it turned out that the issue was that I had a second keyboard plugged in that was upside-down on my desk and spamming a particular key (I'm not sure which one), preventing the shortcut from working. Once I turned that keyboard over so there weren't any keys being held down, my shortcuts started working again.

oxodao commented 7 months ago

Same issue here, my config is the following:

Seemingly randomly, the first two shortcut will no longer work. When this happens the swapping of the Capslock and Escape keys is still working. Calling the one configured in each app does work though so this definitely comes from PowerToys

Restarting Powertoys do not helps. It then later randomly unstuck itself at some point.

Running PT 0.78.0 (Latest) does not solve the issue

jl133780085 commented 7 months ago

Same issue for me; stopped using the software because of it

rbento commented 7 months ago

This problems seems to be related to the PowerToys.AlwaysOnTop process.

I could consistently reproduce it like so:

  1. Remap Caps Lock to Esc
    • Works fine
  2. Bring up the TaskManager
    • Raises a notification from PowerToys for AlwaysOnTop program, which causes the KeyboardManager/Remaps to stop working.
  3. Open PowerToys from the System Tray > Turn off/on either Always On Top or Keyboard Manager
    • Works again until step 2 is repeated.

PowerToys v0.78.0 Edition Windows 11 Home Version 23H2 OS build 22631.3235 Experience Windows Feature Experience Pack 1000.22687.1000.0

oxodao commented 7 months ago

This problems seems to be related to the PowerToys.AlwaysOnTop process.

I could consistently reproduce it like so:

1. Remap Caps Lock to Esc

   * Works fine

2. Bring up the TaskManager

   * Raises a notification from PowerToys for AlwaysOnTop program, which causes the KeyboardManager/Remaps to stop working.

3. Open PowerToys from the System Tray > Turn off/on either Always On Top or Keyboard Manager

   * Works again until step 2 is repeated.

PowerToys v0.78.0 Edition Windows 11 Home Version 23H2 OS build 22631.3235 Experience Windows Feature Experience Pack 1000.22687.1000.0

This is probably not the same issue. Caps-lock to esc never breaks for me, only shortcut related to modifier keys. I never had AOT enabled. The only features I have are keyboard manager, color picker and screen rule.

EDIT: Just had the issue. It seems that locking (Win+L) + unlocking fixed it. Not great but its good to know EDIT2: After a week of usage, locking+unlocking CONSISTENTLY fixes the issue, this was not a one-time thing, its just a pain to do

raprocks commented 5 months ago

facing the same issue with remap of ctrl + escape to ctrl + backtick( ` ), workaround of win + L and unlocking working as of now as mentioned by @oxodao

arminmiau commented 4 months ago

Same Issue with Win + S rebinded to Alt + Space (Windows Search to PowerToys Run) and workaround with locking and unlocking works.

ImDino commented 4 months ago

Happens to me frequently (Windows 11). It stopped working in Ableton 12, I quit the program, went to my Brave browser and it worked there, I re-opened Atleton and it started working there again too.

image

PS. I have it set up this way because some apps (such as Davinci Resolve) already uses Ctrl+Shift+Z as redo.

TenSeventy7 commented 4 months ago

Happens to me as well on a new (OEM) Windows 11 install. The Win+L workaround works, though.

Here's my config:

PowerToys v0.78.1 Edition Windows 11 Home Single Language Version 23H2 OS build 22631.3672 Experience Windows Feature Experience Pack 1000.22700.1009.0

iibach commented 3 months ago

Dear Sir, just doulbe check this haven't been fixed into the latest release. I am on 0.81.1. I am still experiencing shortcut failed and I need to restart the computer to fix it. Mine is mapping alt + a to ctrl + a.

iibach commented 3 months ago

WIN + L can workaround it. Thanks @oxodao ~

worldsayshi commented 1 month ago

I only have:

And I sporadically get this issue. Waking from hibernation might be related. PowerToys v0.83.0.

oxodao commented 1 month ago

I only have:

* Caps Lock to Esc

* Esc to Caps Lock

And I sporadically get this issue. Waking from hibernation might be related. PowerToys v0.83.0.

I replaced PT with AutoHotkey for this use case which comes with its own set of issues, but as far as I remember it happened to me sporadically too but I NEVER used hibernation, always full shutdown.

DanielBakerCF commented 2 weeks ago

Happens to me all the time on Windows 11 and 10.

Mapped Ctrl + C to Ctrl + . Mapped Ctrl + V to Ctrl + /

aLeXv17 commented 18 hours ago

I had same bug, but after disabling "Quick Accent" remapping works stable. Info: Win10 Pro, PowerToys 0.85.0, running as admin.