ililim / dual-key-remap

Remap any key to any other two keys on Windows 🔥. Remap CapsLock to both Ctrl and Escape! (It's like xcape for windows!)
GNU General Public License v2.0
499 stars 36 forks source link

Unable to map CTRL to WINDOWS #23

Closed macatari closed 3 years ago

macatari commented 4 years ago

First of all thanks so much for this program! I'm using it every day at work where I don't have admin privileges.

Since I want to switch to an external keyboard that doesn't have a Windows key I tried to map CTRL to WINDOWS but can't get it to work. I'm on Windows 10 with the latest version of dual key remap and here's how my config looks like:

remap_key=LEFT_CTRL
when_alone=WINDOWS
with_other=WINDOWS

remap_key=CAPSLOCK
when_alone=ESCAPE
with_other=CTRL

debug=1

The output of the debug window is as follow.

Unmapped CTRL keys (left and right)

Logged keypress (Injected: 0, vkCode: 162, scanCode: 29, flags: 0, dwExtraInfo: 0
Logged keypress (Injected: 0, vkCode: 162, scanCode: 29, flags: 128, dwExtraInfo: 0

Logged keypress (Injected: 0, vkCode: 163, scanCode: 29, flags: 1, dwExtraInfo: 0
Logged keypress (Injected: 0, vkCode: 163, scanCode: 29, flags: 129, dwExtraInfo: 0

Mapped CTRL keys (left and right) using the above configuration

Logged keypress (Injected: 0, vkCode: 162, scanCode: 29, flags: 0, dwExtraInfo: 0
Logged keypress (Injected: 0, vkCode: 162, scanCode: 29, flags: 128, dwExtraInfo: 0
Logged keypress (Injected: 1, vkCode: 241, scanCode: 91, flags: 16, dwExtraInfo: 4291022551
Logged keypress (Injected: 1, vkCode: 241, scanCode: 91, flags: 144, dwExtraInfo: 4291022551

Logged keypress (Injected: 0, vkCode: 163, scanCode: 29, flags: 1, dwExtraInfo: 0
Logged keypress (Injected: 0, vkCode: 163, scanCode: 29, flags: 129, dwExtraInfo: 0
Logged keypress (Injected: 1, vkCode: 241, scanCode: 91, flags: 16, dwExtraInfo: 4291022551
Logged keypress (Injected: 1, vkCode: 241, scanCode: 91, flags: 144, dwExtraInfo: 4291022551

WINDOWS key pressed on the internal keyboard of the Laptop

Logged keypress (Injected: 0, vkCode: 91, scanCode: 91, flags: 1, dwExtraInfo: 0
Logged keypress (Injected: 0, vkCode: 91, scanCode: 91, flags: 129, dwExtraInfo: 0

So it looks like that it's sending the wrong vkCode?

Also note that both CTRL keys were mapped although I've put LEFT_CTRL in the config file.

P. S.: The debug window says version 0.4 IIRC.

ililim commented 4 years ago

Interesting, I'll have to investigate this one. I haven't tested every combinations of keys so it could very well be that sending the WINDOWS keys requires some special treatment due to the OS handling it in a unique way.

In the meanwhile, if that binding is a simple 1:1 that doesn't require the dual key functionality, a tool like https://github.com/randyrants/sharpkeys should be able to handle that case. (Can't remember if it needs admin privileges, but could be worth a shot).

(And yeah unfortunately at this time the LEFT_CTRL only works for sending input, but not for detecting it. Haven't had a chance to implement the latter yet.)

macatari commented 4 years ago

Thanks for the quick reply! I got it working now using VK_LWIN instead of WINDOWS. :)

ililim commented 3 years ago

Should be fixed in https://github.com/ililim/dual-key-remap/discussions/36 If not, please feel free to open a new issue :)