cajhin / capsicain

Powerful low-level keyboard remapping tool for Windows
349 stars 18 forks source link

Is it possible to change layers via AHK? #11

Closed darkphan closed 3 years ago

darkphan commented 3 years ago

So a buddy of mine and I are trying to get things setup so that controls in games can get reversed (w = s, a = d, s = w, d = a, etc). This works great using capsicain, however we need to be able to switch layers and no matter what we do in AHK to get it to press ESC+2, etc it doesn't work. Is this even a possibility to do?

cajhin commented 3 years ago

Layer change should just work. I guess either user error or an unusual keyboard.

Not sure what you "do in AHK to get it to press ESC+2". What's the plan here? The idea is you switch with an Esc+Number combo. Do you mean you want AHK to send that combo to capsicain? If so, that won't work. AHK is "higher up in the tower", capsicain does not see what AHK and Windows are doing. You can only work on actual incoming key actions.

To check that layer change works: Open the capsicain window so you see its output. Press ESC, press 1, release 1, release ESC. It should say "Layer change: 1" Does it?

If not, press Esc+H for help or Esc+D for debug. Do the ESC + alpha key combos work?

Maybe I don't understand what you're trying to do. Pls explain, maybe I can advise on the easiest solution.

cajhin commented 3 years ago

Ok looks like I was on the wrong mental track. Today, you cannot send any signals to capsicain. It exclusively listens to keycodes coming from USB.

It should be possible to implement Windows messaging, so AHK could do a SendMessage ("capsicain.exe", WM_Something) but I'm undecided if I want to go there. Lot of effort for a remote triggered layer change (a very specific usecase I guess?). What would you need this for?

darkphan commented 3 years ago

I found a way to do what we were needing, which was a low level way to remap keys and the ability to change those remappings, using AutoHotInterception.

cajhin commented 3 years ago

out of curiosity, what's the use case? Which external event should trigger a layer change?

darkphan commented 3 years ago

Yeah, so we stream video games, and have the ability for our viewers to change our movement keys, so like W becomes S, S=W, A=D and D=A. And after some time it resets back to normal. We have, for most games, been able to just use AutoHotKey to handle this, but some games do a lower level keyboard hook, which capsicain (and AHI) can deal with.

cajhin commented 3 years ago

Well the usecase "let random people on the internet change my keyboard layout" certainly never crossed my mind :) But I'm glad it works for you.