AlynxZhou / showmethekey

Show keys you typed on screen.
https://showmethekey.alynx.one/
Apache License 2.0
306 stars 27 forks source link

Doesn't understand Capslock bound to Escape #29

Closed DuckDuckWhale closed 11 months ago

DuckDuckWhale commented 11 months ago

As a Vim user I mapped my Capslock to Escape in Gnome. This program didn't pick that up and every time I pressed Escape (My "Capslock") it shows Capslock and then all my keystrokes become uppercase. This might be a bit hard to implement because (if I understand it correctly) this reads directly from the input devices, so if it's too hard a toggle button for this configuration would be nice too.

AlynxZhou commented 11 months ago

I mapped my Capslock to Escape in Gnome.

How? The only possible way provided by GNOME I think is in tweaks, if I am correct it swaps keys via X11. This program has nothing to do with X11 or Wayland on getting input, so it won't know that you swapped capslock and escape.

If you only needs simply a swap between 2 keys, I suggest to use udev hwdb instead of X-related solution. It works in lower layer so this program will receive swapped keys, and another pros for udev hwdb is that it also works in tty.

This might be helpful: https://wiki.archlinux.org/title/Map_scancodes_to_keycodes.

David-Else commented 10 months ago

@DuckDuckWhale https://github.com/rvaiya/keyd works on Wayland at least. I am pressing caps lock here using the supplied default script:

image

[ids]

*

[main]

# Maps capslock to escape when pressed and control when held.
capslock = overload(control, esc)