TERMKEY_IN...MODEREPORT(3)
π termkey_interpret_modereport β bestie, let's decode that mode report β¨
okay so real talk, this is termkey_interpret_modereport(3) from the Library Functions Manual and she is exactly what you need when your terminal sends you one of those mysterious little mode reports and you're like "girl what does this even mean" π
π¦ NAME π¦
termkey_interpret_modereport β interpret opaque mode report data
like, it takes the cryptic vibes and turns them into actual numbers. main character energy fr fr π
β¨ SYNOPSIS β¨
#include <termkey.h>
TermKeyResult termkey_interpret_modereport(TermKey *tk, const TermKeyKey *key,
int *initial, int *mode, int *value);
Link with -ltermkey.
bestie do NOT forget that -ltermkey at link time or she will simply not exist, and that is not the slay we're going for π
π DESCRIPTION π
so here's the tea π β termkey_interpret_modereport() fills in variables in the passed pointers according to the mode report event found in key. you call her when termkey_getkey(3) or similar have returned a key event with the type of TERMKEY_TYPE_MODEREPORT. that's your green flag, that's your sign, that's your moment π
any pointer may instead be given as NULL to not return that value. lowkey iconic, honestly β you get to pick and choose which ones you care about and just yeet the rest π«Ά
now for the actual contents, periodt:
- the
initialvariable will be filled with0for an ANSI mode report, or'?'for a DEC mode report π - the
modevariable will be filled with the number of the mode π₯ - and
valuewill be filled with the value from the report β
three little boxes, three little answers, absolutely ate π
π RETURN VALUE π
if you pass her a key event of the type TERMKEY_TYPE_MODEREPORT, this function will return TERMKEY_RES_KEY and will affect the variables whose pointers were passed in, as described above. she said "yes and here's your data" β¨
for other event types it will return TERMKEY_RES_NONE, and its effects on any variables whose pointers were passed in, are undefined. π¨
okay important bestie: if you hand her the wrong event type, she returns TERMKEY_RES_NONE and whatever happens to those pointers after that is genuinely undefined. no promises, no guarantees, no vibes. do not go poking at those variables and expecting answers. that is a mystery box and we do not open mystery boxes π
πΈ SEE ALSO πΈ
go read those too, iykyk, they're the whole friend group π§
and that's the whole page, no cap π β this was TERMKEY_IN...MODEREPORT(3) from the Library Functions Manual, and yes the title really is spelled with that little ... in the middle, that's just her name and we respect it π stay hydrated, read your manpages, and remember: NULL is always an option πβ¨
π¦ where this page comes from
- alpine 3.24: libtermkey-doc 0.22-r4 Β· MIT
- debian trixie: libtermkey-dev 0.22-2+b1 Β· MIT
- epel 10: libtermkey-devel 0.22-2.el10_0 Β· MIT
- epel 9: libtermkey-devel 0.22-2.el9 Β· MIT
- fedora 43: libtermkey-devel 0.22-11.fc43 Β· MIT
- fedora 43: libtermkey-devel 0.22-11.fc43 Β· MIT
- fedora 44: libtermkey-devel 0.22-12.fc44 Β· MIT
- fedora 44: libtermkey-devel 0.22-12.fc44 Β· MIT
- nixos 26.05: libtermkey 0.22
- nixpkgs unstable: libtermkey 0.22
- opensuse-leap 16.0: libtermkey-devel 0.22-bp160.1.11 Β· MIT
- opensuse-leap 16.0: libtermkey-devel 0.22-bp160.1.11 Β· MIT
- opensuse-leap 16.0: libtermkey-devel 0.22-bp160.1.11 Β· MIT
- opensuse-leap 16.0: libtermkey-devel 0.22-bp160.1.11 Β· MIT
- ubuntu questing: libtermkey-dev 0.22-2
- ubuntu resolute: libtermkey-dev 0.22-2build1 Β· MIT
- ubuntu stonking: libtermkey-dev 0.22-3 Β· MIT
- π girlified by deepseek-ai/DeepSeek-V4.1-Flash on : a language model's rewrite of the original, under its terms