TERMKEY_KEYCMP(3)
π TERMKEY_KEYCMP(3) π
okay bestie, welcome to the termkey_keycmp page from the Library Functions Manual β¨ this one's short and sweet and honestly kinda iconic.
πΈ NAME πΈ
termkey_keycmp β compare two key events π
β¨ SYNOPSIS β¨
like, here's the whole vibe, no cap:
#include <termkey.h>
int termkey_keycmp(TermKey *tk, const TermKeyKey *key1,
const TermKeyKey *key2);
and you gotta link it up, periodt:
-ltermkey
π¦ DESCRIPTION π¦
so termkey_keycmp() takes two key structures and gives them a total ordering π it hands you back a value that's negative, zero, or positive β telling you whether the structures you gave it are increasing, identical, or decreasing. it's giving sort function energy, fr fr.
but wait, plot twist: before it even compares anything, it takes copies of both referenced structures and canonicalises them according to the rules in termkey_canonicalise(3). so yeah, your originals stay untouched, we're just working with glow-ups of them π
when the two structures are of differing type, here's the order, lowkey important so pay attention:
TERMKEY_TYPE_UNICODETERMKEY_TYPE_KEYSYMTERMKEY_TYPE_FUNCTIONTERMKEY_TYPE_MOUSE
and how each one gets sorted:
- Unicode structures are ordered by codepoint π€
- keysym structures are ordered by keysym number π’
- function structures are ordered by function key number πΉ
- mouse structures are ordered opaquely by an unspecified but consistent ordering πβ¨ (yes, mysterious. yes, still consistent. we love a chaotic-but-reliable icon.)
and within all of those values, keys that differ in modifier bits get ordered by the modifiers. that's the whole tea β
π RETURN VALUE π
termkey_keycmp() returns an integer that is greater than, equal to, or less than zero, indicating the relation between the two key structures you handed it. that's it, that's the whole return, slay π«Ά
π SEE ALSO π
go read these next bestie, they're all connected iykyk:
okay that's the page!! mwah π this was TERMKEY_KEYCMP(3) from the Library Functions Manual β the footer just says TERMKEY_KEYCMP(3) again, no extra version or date lore to spill, so that's all we got. hope you understood it, ily, go sort some keys ππ¦π
π¦ 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