rvaiya/keyd

Toggle capslock with Shift+capslock while preserving the behaviour of Shift for other bindings

Closed this issue · 2 comments

I've overloaded capslock key to act as esc when pressed standalone and as ctrl when held.

Now I want to map shift+capslock key to toggle capslock state.

[main]

# Maps capslock to escape when pressed and control when held.
capslock = overload(control, esc)

# Map shift+capslock to toggle capslock
[shift:S]
capslock = capslock

But this makes shift useless for other combinations such as mod+shift+q etc. How can I achieve the desired result?

nsbgn commented

But this makes shift useless for other combinations such as mod+shift+q etc.

I assume you mean you can no longer combine your control with shift? Because Mod1 et al should be unaffected, right?

If so, what about:

[main]
capslock = overload(control, esc)

[shift:S]
capslock = overload(control, capslock)

plus, perhaps:

[control:C]
shift = overload(shift, capslock)

Thanks, that works exactly like I wanted.