keyok(3NCURSES)
π keyok β the manual, but make it a group chat π
okay bestie, so this is a page from the ncurses library calls section (yes, 3NCURSES, the whole vibe), and it's literally just about one little function called keyok. it lets you turn a function key code on or off. that's the whole thing. iconic behavior honestly. π
β¨ NAME β¨
keyok β enable or disable an ncurses function key code π¦
β¨ SYNOPSIS β¨
#include <curses.h>
int keyok(int key-code, bool bf);
like. that's it. two args. we love a low-maintenance king. π
β¨ DESCRIPTION β¨
so keyok is an ncurses extension (more on that in a sec, bestie, don't spiral), and what it does is it lets a curses application disable a function key key-code that would otherwise come back at you from wgetch(3NCURSES).
and if you're one of the wide-character API girlies? that's wget_wch(3NCURSES) for you. same energy, different letter. πΈ
and here's the part that actually slays: key codes that have been disabled can be re-enabled. you're not dooming them forever. it's giving reversible. it's giving "we can fix her". π
bf is the lil parameter that selects the desired enablement status β that's your on/off switch, your vibe check, your whole entire decision. π«Ά
and the way this is more fine-grained than just calling keypad(3NCURSES)?? because keypad(3NCURSES) affects all the function keys, like a group punishment, whereas keyok lets you pick and choose. main character energy fr fr. no cap. π
β¨ RETURN VALUE β¨
keyok returns ERR when:
key-codeis nonpositive πkey-codeis not a recognized value π- enablement of
key-codeis already in the desired state β like bestie, it's already doing that. nothing to change. π
otherwise? keyok returns OK. and we celebrate. π
β¨ EXTENSIONS β¨
keyok is an ncurses extension. periodt. π
β¨ PORTABILITY β¨
okay so this is the part where we're responsible adults for one (1) second:
applications employing ncurses extensions should condition their use on the visibility of the NCURSES_VERSION preprocessor macro. like, check before you use it, bestie. be safe out there. π
and the good news: NetBSD curses since 2.0 (2004) supports keyok. so it's not just an ncurses thing anymore, she's been out here since 2004. ate. β
β¨ AUTHORS β¨
Thomas Dickey π
β¨ SEE ALSO β¨
ncurses(3NCURSES)define_key(3NCURSES)keybound(3NCURSES)keyok(3NCURSES)key_defined(3NCURSES)
(yes, keyok(3NCURSES) is in its own SEE ALSO list. she's self-referential. she contains multitudes. iykyk. π
)
and that's the whole page, bestie!! this was ncurses version 6.6, dated 2025-10-04 β go forth and toggle your function keys responsibly, mwah πβ¨π¦πΈ
π¦ where this page comes from
- ubuntu resolute: ncurses-doc 6.6+20251231-1 Β· MIT/X11
- ubuntu stonking: ncurses-doc 6.6+20260608-2 Β· MIT/X11
- Copyright 2018-2024,2025 Thomas E. Dickey
- Copyright 1998-2010,2017 Free Software Foundation, Inc
- π girlified by deepseek-ai/DeepSeek-V4.1-Flash on : a language model's rewrite of the original, under its terms