guilryder / clavier-plus

Clavier+ keyboard shortcuts manager for Windows
https://gryder.org/software/clavier-plus/
GNU General Public License v3.0
326 stars 21 forks source link

Windows key + \ doesn't work after PC reboot #12

Closed snakehill closed 2 years ago

snakehill commented 2 years ago

Shortcuts containing the Windows key, e.g. Win + \, don't work after rebooting my computer.

Any other shortcut still works, and after I edit the shorcut with the same exact input, it works again also.. until my computer is shut down or rebooted again.

(Windows 10 Pro)

guilryder commented 2 years ago

This issue looks specific to your computer or configuration: no problem with Windows 10 Pro on my computer.

Other programs or Windows itself may override / delete / capture the shortcuts that Clavier+ creates.

Try opening and closing the Clavier+ configuration window to force Clavier+ to re-create the shortcuts (no need to edit individual shortcuts).

snakehill commented 2 years ago

Simply opening and closing the configuration window doesn't seem to help.

Hereby a video of the issue: Watch the video

snakehill commented 2 years ago

After some more testing, it seems to not be the Windows key but the backslash ( \ ) that causes the issue.

I had a look at Clavier.ini. I see the file is being recreated upon boot (it has a completely different order of shortcuts), but the code itself changes along also.

After editing and re-entering the shortcut:

Shortcut=Win + \
Code=2274

Upon (re)boot:

Shortcut=Win + \
Code=2268

It seems to me that the shortcut and code should both remain, otherwise things might get rebuilt wrongly as is the case here. It's really only on boot that it changes though. When I reopen and close the configuration window, or edit another shortcut, the code stays 2274 and keeps working.

guilryder commented 2 years ago

Thanks for investigating!

The root issue is that Windows has two key codes for the "\" key, because they are actually different hardware keys:

This is consistent with what you found out: the issue is specific to the "\" part of the keystroke: the issue should occur with any combination of special keys, even none, not just the Windows key.

When you create a shortcut for Win + \, Clavier+ writes into Clavier.ini the shortcut name (Shortcut=Win + \) then the code it detected (Code=2274).

When Clavier+ loads Clavier.ini later, it successfully parses Shortcut=Win + \ into Win + VK_OEM_5 i.e. code 2268 (not Win + VK_OEM_102 i.e. code 2274) and ignores the Code=2274 line. Clavier+ uses the Code= line only when unable to parse the Shortcut= line, as a fallback for when key names change across Windows versions, languages, etc. Then Clavier+ overwrites Clavier.ini with Code=2268.

A simple solution is to give a different name to VK_OEM_102 like #226, to let Clavier+ accurately parse the key name from Clavier.ini. I will prepare a new version of Clavier+ with that change.

guilryder commented 2 years ago

Beta version available in http://utilfr42.free.fr/dn/beta/Clavier.exe

Can you let me know if it fixes the issue for you?

snakehill commented 2 years ago

Thanks! The beta works, saves and rebuilds it perfectly!

Shortcut=Win + #226
Code=2274

The only "issue" is that Win + #226 might be a little difficult to decipher when looking in the list of shortcuts, were anyone to do that to remind themselves of the shortcuts. But I personally don't mind it, nor would I have any idea what it should be called otherwise.

guilryder commented 2 years ago

Fixed in https://github.com/guilryder/clavier-plus/commit/5490c65eaed075db2aafc2c93df735b08d2c7b26, released in: https://github.com/guilryder/clavier-plus/releases/tag/release11.1.1