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

Key rebinding assumes QWERTY #682

Closed
antifuchs opened this issue Jul 21, 2017 · 9 comments
Closed

Key rebinding assumes QWERTY #682

antifuchs opened this issue Jul 21, 2017 · 9 comments

Comments

@antifuchs
Copy link

I use the Colemak keyboard layout, and I was very very confused why my key bindings weren't correct - turns out that you have to specify the bindings using the location of the QWERTY key, not via their actual place in the layout. This seems like a semi-known issue (see this comment), but it is pretty confusing.

The main pain point here is that I can't share my config files with people who use other layouts (be it QWERTY, AZERTY, QWERTZ or Dworak!).

I would love if alacritty would let us specify key bindings by what real key they send, not by what their location on a QWERTY layout is.

@jwilm
Copy link
Contributor

jwilm commented Aug 3, 2017

Which OS are you on?

@antifuchs
Copy link
Author

This is on macOS 10.12.6.

@jwilm
Copy link
Contributor

jwilm commented Aug 25, 2017

Ah yeah, this is a winit bug. There's a few other issues like this.. I should really consolidate. Will follow up with a canonical issue to follow once that happens.

@k0nserv
Copy link
Contributor

k0nserv commented Oct 21, 2017

It seems to be half working. I use a Swedish QWERTY modification. With my layout alt+a is ; and from trying with --print-event this seems to be correctly mapped.

glutin event: WindowEvent { window_id: WindowId(Id(140227854255760)), event: KeyboardInput { device_id: DeviceId(DeviceId), input: KeyboardInput { scancode: 58, state: Pressed, virt
ual_keycode: Some(LAlt), modifiers: ModifiersState { shift: false, ctrl: false, alt: true, logo: false } } } }
glutin event: WindowEvent { window_id: WindowId(Id(140227854255760)), event: KeyboardInput { device_id: DeviceId(DeviceId), input: KeyboardInput { scancode: 0, state: Pressed, virtu
al_keycode: Some(A), modifiers: ModifiersState { shift: false, ctrl: false, alt: true, logo: false } } } }
glutin event: WindowEvent { window_id: WindowId(Id(140227854255760)), event: ReceivedCharacter(';') }
glutin event: WindowEvent { window_id: WindowId(Id(140227854255760)), event: KeyboardInput { device_id: DeviceId(DeviceId), input: KeyboardInput { scancode: 58, state: Released, vir
tual_keycode: Some(LAlt), modifiers: ModifiersState { shift: false, ctrl: false, alt: false, logo: false } } } }
glutin event: WindowEvent { window_id: WindowId(Id(140227854255760)), event: KeyboardInput { device_id: DeviceId(DeviceId), input: KeyboardInput { scancode: 0, state: Released, virt
ual_keycode: Some(A), modifiers: ModifiersState { shift: false, ctrl: false, alt: false, logo: false } } } }

As you can see above one of the events is ReceivedCharacter(';') which is correct. However what actually happens in Alacritty is that my Zsh goes from insert mode to command mode without inserting ;.

The same thing happens for all my modifiers using the alt key. I'm not quite sure why my ZSH is responding by exiting insert mode as that should happen on ESC or jk with my config

Example: Here I'm trying my different modifiers each of which takes my out of insert mode
keys

Both nvim and cat correctly handle these modifiers.

@jwilm
Copy link
Contributor

jwilm commented Oct 21, 2017

That's really strange.. are you also on macOS?

@k0nserv
Copy link
Contributor

k0nserv commented Oct 21, 2017

Yeah I'm on Sierra(10.12.6). My keyboard layout is achieved with a normal OS-level keyboard layout. I also use Karabiner, but for this recent example I tured it off.

example

EDIT: Anything you'ld like me to try?

@k0nserv
Copy link
Contributor

k0nserv commented Oct 21, 2017

I suspect this might be what causes the issue

https://github.com/jwilm/alacritty/blob/9f79d72109b5745c32a8c0bdd4d17799f827fbba/src/input.rs#L480-L483

I dont have the full context for to understand this, but it seems to be sending a single ESC which seems like it would cause the behaviour we are seeing.

EDIT: I verified it by removing those lines and it does indeed solve the issue.

@k0nserv
Copy link
Contributor

k0nserv commented Nov 4, 2017

Following on this while the above solves a lot of the issues with my layout, some keys still don't work. For example alt+¨ should be ~ but that has no effect. This is the log

glutin event: WindowEvent { window_id: WindowId(Id(140316342593488)), event: KeyboardInput { device_id: DeviceId(DeviceId), input: KeyboardInput { scancode: 61, state: Pressed, virtual_keycode: Some(LAlt), modifiers: ModifiersState { shift: false, ctrl: false, alt: true, logo: false } } } }
glutin event: WindowEvent { window_id: WindowId(Id(140316342593488)), event: KeyboardInput { device_id: DeviceId(DeviceId), input: KeyboardInput { scancode: 30, state: Pressed, virtual_keycode: Some(RBracket), modifiers: ModifiersState { shift: false, ctrl: false, alt: true, logo: false } } } }
glutin event: WindowEvent { window_id: WindowId(Id(140316342593488)), event: KeyboardInput { device_id: DeviceId(DeviceId), input: KeyboardInput { scancode: 30, state: Released, virtual_keycode: Some(RBracket), modifiers: ModifiersState { shift: false, ctrl: false, alt: true, logo: false } } } }
glutin event: WindowEvent { window_id: WindowId(Id(140316342593488)), event: KeyboardInput { device_id: DeviceId(DeviceId), input: KeyboardInput { scancode: 61, state: Released, virtual_keycode: Some(LAlt), modifiers: ModifiersState { shift: false, ctrl: false, alt: false, logo: false } } } }

In a similar vain shift+¨ should be ^ but also has no effect.

glutin event: WindowEvent { window_id: WindowId(Id(140216580002960)), event: KeyboardInput { device_id: DeviceId(DeviceId), input: KeyboardInput { scancode: 56, state: Pressed, virtual_keycode: Some(LShift), modifiers: ModifiersState { shift: true, ctrl: false, alt: false, logo: false } } } }
glutin event: WindowEvent { window_id: WindowId(Id(140216580002960)), event: KeyboardInput { device_id: DeviceId(DeviceId), input: KeyboardInput { scancode: 30, state: Pressed, virtual_keycode: Some(RBracket), modifiers: ModifiersState { shift: true, ctrl: false, alt: false, logo: false } } } }
glutin event: WindowEvent { window_id: WindowId(Id(140216580002960)), event: KeyboardInput { device_id: DeviceId(DeviceId), input: KeyboardInput { scancode: 30, state: Released, virtual_keycode: Some(RBracket), modifiers: ModifiersState { shift: true, ctrl: false, alt: false, logo: false } } } }
glutin event: WindowEvent { window_id: WindowId(Id(140216580002960)), event: KeyboardInput { device_id: DeviceId(DeviceId), input: KeyboardInput { scancode: 56, state: Released, virtual_keycode: Some(LShift), modifiers: ModifiersState { shift: false, ctrl: false, alt: false, logo: false } } } }

¨ on its own is also ignored producing

glutin event: WindowEvent { window_id: WindowId(Id(140639608046816)), event: KeyboardInput { device_id: DeviceId(DeviceId), input: KeyboardInput { scancode: 30, state: Pressed, virtual_keycode: Some(RBracket), modifiers: ModifiersState { shift: false, ctrl: false, alt: false, logo: false } } } }
glutin event: WindowEvent { window_id: WindowId(Id(140639608046816)), event: KeyboardInput { device_id: DeviceId(DeviceId), input: KeyboardInput { scancode: 30, state: Released, virtual_keycode: Some(RBracket), modifiers: ModifiersState { shift: false, ctrl: false, alt: false, logo: false } } } }

For these cases neither vim nor cat correctly handle the input either

@jwilm
Copy link
Contributor

jwilm commented Nov 7, 2017

Closing in favor of #458.

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

No branches or pull requests

3 participants