rvaiya / keyd

A key remapping daemon for linux.
MIT License
2.8k stars 167 forks source link

How to keep left/right shift distinct, but remap shifted keys? #771

Open Artemis21 opened 3 months ago

Artemis21 commented 3 months ago

I would like leftshift and rightshift to emit distinct events (I use touch typing software that detects this to enforce using the opposite shift). I achieved that like this:

[main]
rightshift = rightshift

However, I'd now like to map shift+esc to a backtick. I tried writing this:

[main]
rightshift = rightshift

[shift]
esc = `

But that only works for left shift, since rightshift is no longer bound to the shift layer. Then I tried

[main]
rightshift = layer(rightshift)

[shift]
esc = `

[rightshift]
esc = `

But now rightshift doesn't function as a normal shift key. Finally I tried

[main]
rightshift = layer(rightshift)

[shift]
esc = `

[rightshift:S]
esc = `

But now the distinction between left and right is gone again. How can I do this?

nsbgn commented 3 months ago

Try rightshift = overload(shift, rightshift) if your software requires the difference only when rightshift is tapped in isolation. Is that the case?

Otherwise, you can use the following hacky solution:

[main]
rightshift = layer(rightshift)

[shift]
esc = `

[rightshift:S]
esc = `
a = rightshift+a
b = rightshift+b
# etcetera

Later, I will link some related issues. Especially you have to use the second suggestion, your use case would be quite relevant there.

Artemis21 commented 3 months ago

Thanks for the quick response!

Try rightshift = overload(shift, rightshift) if your software requires the difference only when rightshift is tapped in isolation. Is that the case?

Unfortunately not, the main point of it is for ensuring the correct typing capitalised letters. I will try the hacky solution - I had rejected it before but I didn't think of making it inherit from normal shift so I only had to write out combinations where the distinction was important. Thanks!