rvaiya / keyd

A key remapping daemon for linux.
MIT License
2.75k stars 162 forks source link

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

Closed raknos13 closed 3 months ago

raknos13 commented 3 months ago

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 3 months ago

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)
raknos13 commented 3 months ago

Thanks, that works exactly like I wanted.