Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Both Left and Right Control are identified as Left Control. #941

Open
error404seeker opened this issue Feb 20, 2025 · 6 comments
Open

Both Left and Right Control are identified as Left Control. #941

error404seeker opened this issue Feb 20, 2025 · 6 comments

Comments

@error404seeker
Copy link

This is causing problem as there is some difference in left and right control press in neovim.

@rvaiya
Copy link
Owner

rvaiya commented Feb 20, 2025

This is by design, please read the layers section of the man page.

there is some difference in left and right control press in neovim.

The terminal should not be able to distinguish between right and left control. Can you elaborate on this?

@error404seeker
Copy link
Author

in Neovim(Lazyvim), when I press Left Control in insert mode, it goes back to Normal Mode. When I press Right control, it doesn't change anything. I use kitty and have confirmed it by disabling keyd. When I use keyd, both left and right control change from insert mode to normal mode.

@rvaiya
Copy link
Owner

rvaiya commented Feb 23, 2025

Have you remapped something? As a rule, terminals do not distinguish between right and left modifiers, they are stored as a bitmask. Kitty seems to have some new keyboard protocol, but that is not natively supported by any application I am aware of. It is possible that lazyvim uses this protocol to distinguish between right and left control, but I cannot find this documented anywhere.

In any case, I very much doubt left control is mapped to escape in lazyvim (it certainly isn't in neovim), since this would make default behaviour dependent on kitty's proprietary protocol (the vast majority of terminals will just flip a bit, which does not allow the program to distinguish between right and left control).

@victor-gaganov
Copy link

I am facing the same issue. My RDP client (remmina) uses Ctrl_R + F4 to close connection to remote host. There are many pieces of software that do different things depending on Left/Right Ctrl or Alt. If you want an easy reproducer take a look at Via key tester (https://www.caniusevia.com/). Even the online version detects that Right Ctrl sends Left Ctrl (https://www.usevia.app/). After I stop keyd service, key tester starts detecting Right Ctrl again.

OS: Ubuntu 20.04

Config:

[ids]

[main]
capslock = layer(nav)
\ = layer(nav)

[nav]
j = left
i = up
k = down
l = right
u = C-left
o = C-right
y = pageup
h = pagedown
m = C-pageup
. = C-pagedown
, = delete
p = home
; = end
4 = =
r = )
f = ]
v = |
3 = +
e = (
d = [
c = }
2 =
w = -
s = _
x = {

I hope this can get fixed. I loved keyd for simple config format and nice systemd integration. But this is a serious issue for me.....

@rvaiya
Copy link
Owner

rvaiya commented Feb 24, 2025

@victor-gaganov

If you aren't aware, you can already remap any key to rightcontrol just like any other keycode. The present issue concerns the default mapping of both left and right control to layer(control) which is a modifier layer defined as control:C. Changing this has been discussed before, and has a few downstream consequences.

If you really need rightcontrol to be available, you can just do rightcontrol = rightcontrol in the worst case, though my recommendation would be to bind the sequence of interest to a macro inside of a layer (e.g macro(rightcontrol+f4)).

@victor-gaganov
Copy link

victor-gaganov commented Feb 24, 2025

I was not aware of this. For me, this fix works. Thank you! I added rightcontrol = rightcontrol to my main layer and all software that has different behavior started to work.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants