keyd icon indicating copy to clipboard operation
keyd copied to clipboard

Exclusive layers / modifiers?

Open MoltenMonster opened this issue 8 months ago • 5 comments

For instance, I want to remap Alt M to 1 but when I press only the Alt key. I would also like to be able to specify which modifiers would be allowed, like the shift key, so Alt Shift M would output !

MoltenMonster avatar Apr 14 '25 22:04 MoltenMonster

I think you need to redefine your mappings in a composite.

[alt]
m = 1

[alt+shift]
m = 1

edit

I thought that your ! was a 1. Which keyboard layout do you use on your system? If ! is S-1, then you don't need anything special apart:

[alt]
m = 1

lobre avatar Apr 15 '25 06:04 lobre

@lobre The issue is that for instance if I type CTRL ALT M, it registers as CTRL 1. I only want it to be 1 if I press Alt M or ! if I press Alt Shift M.

MoltenMonster avatar Apr 17 '25 10:04 MoltenMonster

I am sorry but I don't understand your problem.

For sure it seems easy to fix, but for us to understand your problem, please post your existing config, give us your system keyboard layout, and a precise explanation of what you are trying to do. Like, what do you press, what it does, and what you would like instead.

A general advice that I can give you is that modifiers stack together, except if you redefine what you want in composite layers.

E.g.

[control+alt]
m = 1
...

[control+shift]
m = 1
...

[shift+alt]
m = 1
...

[control+alt+shift]
m = 1
...

Chose the ones you need, but it precisely defines what happens when multiple layers are added together instead of stacking them.

lobre avatar Apr 17 '25 11:04 lobre

  • I want Alt M mapped to 1
  • Alt Shift M mapped to !
  • Pressing Alt and M with any modifiers other than shift, just emits those keys.
    • For instance, CTRL Alt M presses those three keys, and doesn't emit either 1 or !.

MoltenMonster avatar Apr 17 '25 21:04 MoltenMonster

This is tricky.

I am not in front of a computer but maybe something like that.

[main]
alt = layer(myalt)
control = layer(mycontrol)

[myalt:A]
control = layer(mycontrol)
m = 1

[mycontrol:C]
alt = layer(alt)
m = C-m

lobre avatar Apr 18 '25 13:04 lobre