cajhin / capsicain

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

It it possible to make custom mod key act as control when there's no mapping for a key combo? #108

Closed carljohnson93 closed 4 months ago

carljohnson93 commented 4 months ago

I'm using keyd on linux, and wanted something similar on windows. Your program is a lifesaver, so thank you. Here's my simple keyd, config:

[ids]
*

[main]
capslock = overload(home_arrows_or_control, escape)

[home_arrows_or_control:C]
h = left
j = down
k = up
l = right

Ignore the [ids] section. As you can see home_arrows_or_control layer has special syntax in its header - :C, this means that when I activate this layer by holding capslock and pressing some key, control will be sent with that key if if wasn't found in the keymaps listed in this layer. If keymap is found, it is sent without control. Is there something similar in capsicain? This is very useful as I can use one key as both control and layer key, and if I need to press e.g. Ctrl-K I'll just press regular control with K.

cajhin commented 4 months ago

hi, sure you can do this with

REWIRE CAPS LCTRL
combo J [.... .... ..&.] > moddedKey(LEFT+.)
combo ; [.... .... ..&.] > moddedKey(RIGHT+.)

This makes your capslock a control key. Then you must define a combo for each control+X combo you want.

The downside is, that the original ctrl+X combo is no longer available, so you cannot do the original ctrl+JKL: combo anymore. I don't know a workaround for this, other than rewiring capslock to a virtual modifier (e.g. MOD9), and then defining all possible combos for mod9+key (e.g. mod9+S -> ctrl+S), which could be like 50 combos...

Note: for this case, moddedKey() must be used instead of the simple key(). The main difference is that only moddedKey will first release all modifiers (the control key that Windows knows is down), then send the keycombo (plain LEFT), then press the modifiers again (control down)


Update: this is actually what I do myself, and what I would recommend. I don't rewire caps to a real modifier, I make it virtual mod9 instead, so it does not interact with Windows in any way, which removes complications. Then caps shifts to my "cursor control layer", which I use a LOT. Control combos I still do with my regular control key, plus a few extra combos like "caps+A = ctrl-Z" I do this like:

REWIRE CAPS MOD9
combo J [...& .... ....] > key(LEFT)
combo A [...& .... ....] > combo(LCTRL + Z)

Please close this issue when it works for you and you have no more questions

....wait, what, your cursor keys are on HJKL and not in JKL; ??? That doesn't make sense for touch typing where your fingers rest on JKL;? I've grown to accept vi, but that's silly :)

carljohnson93 commented 4 months ago

No my cursor keys are actually jkl; and also I'm using Colemak dh layout, I've just made up simple config for this issue :) Okay, as far as I understand capsicain does not have the functionality I described, alright it's not a big deal I'll just use capslock for arrows layer and tab as control when held. Thanks for your help.