💾 Archived View for ftrv.se › 17 captured on 2023-01-29 at 02:34:38. Gemini links have been rewritten to link to archived content
⬅️ Previous capture (2022-06-03)
-=-=-=-=-=-=-
Alt acts as a "compose" key by default, and there is little to no way to change this. At the same time, a small hack can be used to cancel the compose mode by fake-pressing Alt through `/dev/kbin`: writing the scancode of the key to it. Whether it works (or not) in drawterm is left as an exercise to the reader, as usual.
For this to work, your program needs to read `/dev/kbd` directly, and keep `/dev/kbin` open for writing.
Both orca[1] and FT2 clone[2] are using this approach. You can test it by comparing "Alt, 1, 2" and "Alt, Alt, 1, 2" in a rio window.
clone
The scancode is easy to find:
; g '(KF|Kalt)=' /sys/include/keyboard.h /sys/include/keyboard.h:23: KF= 0xF000, /* Rune: beginning of private Unicode space */ /sys/include/keyboard.h:38: Kalt= KF|0x15, ; grep `{echo 'dec(0xf000|0x15)' | pc -n} /dev/kbmap 0 56 61461 0 70 61461 1 56 61461 1 70 61461 4 56 61461
An example of the logic:
if(r == Kalt) write(kbin, "\x46", 1);
Happy hacking.