Neovide: XKB: caps:swapescape doesn't work

Created on 28 Jan 2020  路  13Comments  路  Source: Kethku/neovide

I have caps and escape swapped through xkb_options, but that isn't reflected during use

Quite possibly upstream, just reporting here to do some basic checks if it's just not implemented/used

bug help wanted

All 13 comments

Seems to work fine in Alacritty so I'd be surprised if it's a problem in winit

This is related to https://github.com/Kethku/neovide/issues/27 I need to spend some time reading alacritty's source

Maybe related, maybe not: tilde doesn't work for me, just does nothing lol

I think it probably is. The solution I am using is not ideal. I basically list virtual key codes and map them manually. There has been some discussion that a better solution would be to use the receive char functionality in Winit, but that wouldn't support keys which don't produce a character. So I'm kinda stuck

Wezterm just abandoned Winit and rolled its own haha. Druid-shell is doing something similar

Maybe I'm overestimating how hard it is to just roll your own binds like that, but that seems like a ton of work

Its a tradeoff right. It looks like a lot, but its very understandable and ideally you build the list once and don't have to worry about it. The place I run into trouble is when my assumptions don't fit properly to all setups.

I just realized youre the core maintainer on alacritty! Maybe you can help me with your expertise with using Winit. Let me go into some more details about the problem.

The Neovim key input is very strange. Keybindings are sent to it as a string with the same format you use to map keybindings inside of vim. This has a couple of weird effects:

  1. there is a set of keys which don't provide text which need to be escaped with angle brackets (sometimes mapping the name to something different as well),
  2. some keys which do have clear text values also need to be mapped to a different name and escaped with angle brackets
  3. modifiers must be applied with a
  4. for some keys specifically with shift key modification the expectation is that the modified key should be sent instead of the expectation is that we send ! directly.

So I thiiink the correct strategy is to use the ReceivedCharacter event with a small set of transforms for characters which must be escaped, use KeyboardInput for remaining keys which do not produce values, and use ModifiersChanged to track modifiers and append to the previous event values.

This leads to caps:swapescape you were mentioning. I'm not sure how that interacts with KeyboardInput which is likely where it will fit in for my proposed rewrite.

Does this make sense to you? Do you have any relevant thoughts? I'd appreciate your expertise :)

Wait who are you referring to?

I made like one change to alacritty to allow for variable scroll sensitivity lol :P

jwilm is probably who you're thinking of

Ah youre right. :P I'm bad at internetting.

In that case I will close this and copy the summary to the main keyboard issue.

No worries, have been trying to figure out wayland/rust interop though (re https://github.com/szbergeron/simply-wayland-rs, https://github.com/szbergeron/rust_term) so will hopefully be able to help with that kind of stuff in the near future :)

I think wayland support has now landed in skulpin upstream so we may be good on that front now :)

Was this page helpful?
0 / 5 - 0 ratings

Related issues

obreitwi picture obreitwi  路  4Comments

dineshKumar777 picture dineshKumar777  路  6Comments

basus picture basus  路  4Comments

Vui-Chee picture Vui-Chee  路  6Comments

JakubKoralewski picture JakubKoralewski  路  7Comments