NHotkey icon indicating copy to clipboard operation
NHotkey copied to clipboard

The NHotkey of WinForms does not support using Win keys as function keys

Open ZheYinX opened this issue 10 months ago • 3 comments

As the title suggests, do you have any solutions? Or can I make some updates to this project? Thank you!

ZheYinX avatar Jan 23 '26 05:01 ZheYinX

Hi @ZheYinX,

It is indeed not supported at the moment. The Keys enum in Windows Forms doesn't have a value for the Windows modifier key (it has LWin and RWin, but that's for the keys themselves, not as modifiers).

Looking at the code, I see that I had tried to do something with LWin and RWin, but it doesn't really make sense.

I guess it might be possible to support it; it would need to use a special Keys value that's not actually defined in the enum, but that the library could expose and map to the proper modifier, e.g. something like this:

HotkeyManager.Current.AddOrReplace("Increment", WindowsKey.Modifier | Keys.Add, OnIncrement);

I'll see if I can make it work.

thomaslevesque avatar Jan 23 '26 08:01 thomaslevesque

I implemented the change, but now I need to migrate my outdated CI pipeline to be able to release a new version 😅

thomaslevesque avatar Jan 23 '26 10:01 thomaslevesque

This change has been released in version 4.0.0

thomaslevesque avatar Jan 23 '26 13:01 thomaslevesque