Understanding Keyboard Events Better
rugu.dev
rugu.dev
Although many people today use Caps Lock for this, the Esc in these terminals was originally in Tab's position.
- using Tab while in insert mode leaves the insert mode
- using Tab while typing commands enables the autocomplete
I believe this is a great setup to be closer to the home row when it's not possible to remap Caps to Esc (when alone)+Control (when chorded)
I need to reliably enter/leave edit mode way more than I need to insert tabs, but I can still insert tabs when needed with Ctrl-q Tab
When do you need to insert tabs in vim?
Personally, I rarely need to insert raw tabs: the only exception may be Makefiles (and for that I have a configuration)
Ultimately I think the USB HID protocol is bit too crude for these programmable keyboards, because now I need to juggle two sets of keymaps (one on KB side and another on OS side) to accomplish what I want, and it in no way works reliably across computers or OSs. Either that, or OSs should provide better facilities for remapping stuff and handling arbitrary layouts so that keyboards can revert back to being dumb again.
This. Also, even if trying to do without a keyboard (I can't carry one anywhere I go, but I can prepare scripts and environments!), "advanced" scripts can confuse the input handling layer.
> Either that, or OSs should provide better facilities for remapping stuff and handling arbitrary layouts so that keyboards can revert back to being dumb again.
Even if you have better facilities, it's never perfect: I have a Caps to Esc+Control directly on the wayland composer that is quite reliable: Hyprland has advanced options to do key binding and remapping (https://wiki.hyprland.org/Configuring/Binds/) which is a wonderful thing to have when your workflow is keyboard centric.
However, gvncviewer sometimes gets its Caps status confused, and I have to close it and start it again to have access to the unshifted symbols (while it still works for the letter... so it does something like Shift Lock, and while I would love it to work well I can't spend time on just 1 application that refuses to work well with the settings every other application seems to be fine with.
Maybe worth checking if one is not supported to use libinput instead of processing kernel events directly though. [2]
If someone is interested in the input topic, Peter Hutterer's blog is very nice to read. I also enjoyed his talk about libinput's bus factor [3].
[1] https://who-t.blogspot.com/2013/09/libevdev-handling-input-e...
[2] https://who-t.blogspot.com/2018/07/why-its-not-good-idea-to-...
[3] https://who-t.blogspot.com/2019/10/libinputs-bus-factor-is-1...
I also regularly switch between keyboard layouts and when I switch from eg. Chrome to the terminal the keyboard layout changes.
Anyway, great job sir! Now I will read your code out of curiosity :)