keybound(3X)
π keybound(3X) β Library calls π
okay bestie, welcome to the keybound page, it's giving niche-but-iconic and I'm obsessed π
β¨ NAME β¨
keybound β get the definition of a curses function key code π
πΈ SYNOPSIS πΈ
#include <curses.h>
char * keybound(int key-code, int count);
π¦ DESCRIPTION π¦
So keybound is an ncurses extension, and what it does is let a curses app grab the value of the string that's bound to the function key key-code π
(peep wgetch(3X) for the deets β and if you're on the wide-character API, that's wget_wch(3X) for you specifically π«Ά).
By default, those bindings are string capabilities coming straight out of the terminfo database entry that matches your terminal type. no cap, that's just where they live π
Now here's the slay part: your app can override those definitions with define_key(3X), and it can do it non-destructively and repeatedly β like it's pushing new definitions onto a stack. it's giving stack energy fr fr πβ¨
The count parameter is how you access the *n*th most recently defined binding. and 0? that one selects the binding that actually gets used on input. periodt π
π₯ RETURN VALUE π₯
If key-code corresponds to a function key that's defined by the application or by the terminal type in use, keybound allocates and returns a string β and heads up, that string must be freed by the application π«Ά don't leave it hanging bestie, that's a leak π
keybound returns NULL if key-code is not positive, or if it doesn't correspond to a key code definition. that's it, that's the whole vibe check π
π EXTENSIONS π
keybound is an ncurses extension β¨
π PORTABILITY π
If you're using ncurses extensions, you should condition your use of them on whether the NCURSES_VERSION preprocessor macro is visible. fr fr, gate it π
π AUTHORS π
Thomas Dickey π
π SEE ALSO π
curses(3X)define_key(3X)keyok(3X)key_defined(3X)terminfo(5)
π¦ quick reminder bestie:NULLmeans free nothing, a real string meansfree()it. the way that memory management is literally main character energy ππ
and that's the whole page, mwah π this one's from ncurses 6.6, dated 2024-12-28 β yes it's serving vintage but it's still iconic, bye bestie πβ¨
π¦ where this page comes from
- alpine 3.24: ncurses-doc 6.6_p20260516-r0 Β· X11
- arch rolling: ncurses 6.6-2 Β· MIT-open-group
- fedora 44: ncurses-devel 6.6-1.fc44 Β· MIT-open-group
- fedora 44: ncurses-devel 6.6-1.fc44 Β· MIT-open-group
- Copyright 2018-2023,2024 Thomas E. Dickey
- Copyright 1999-2008,2010 Free Software Foundation, Inc
- π girlified by deepseek-ai/DeepSeek-V4.1-Flash on : a language model's rewrite of the original, under its terms