keyok(3X)
π keyok(3X) β library calls, but make it a vibe π
okay bestie, pull up a chair, we're talking about keyok from the curses library (section 3X, library calls, you know the drill). This is the one that lets you enable or disable an ncurses function key code, and honestly? iconic behavior. π
β¨ NAME β¨
keyok β enable or disable an ncurses function key code
like. the name says it all fr fr. key. ok. key ok? key NOT ok. you decide. π
πΈ SYNOPSIS πΈ
#include <curses.h>
int keyok(int key-code, bool bf);
two args, one int of return, we love a low-maintenance queen π«Ά
π¦ DESCRIPTION π¦
so the tea is: keyok is an ncurses extension, and what it does is let a curses application disable a function key key-code that would normally come back to you from wgetch(3X).
and for the wide-character girlies out there β that's you if you're living in wget_wch(3X) land β same deal, it applies to you too. π
now, key codes that have been disabled? they can absolutely be re-enabled. it's not a permanent situation, bestie. nothing is forever.
the bf parameter is the mood-setter here β it selects the desired enablement status. so bf is basically holding up the little "on/off" sign. πͺ§
and why is this such a slay? because this operation is more fine-grained than calling keypad(3X), which affects all function keys at once. keyok is the "i want to customize one specific thing" version. it's giving main character energy, it's giving precision, it's giving "i don't do group settings." π
π RETURN VALUE π
keyok returns ERR if any of these lil situations happen:
- key-code is nonpositive
- key-code is not a recognized value
- enablement of key-code is already in the desired state
not me getting an error because the thing is already exactly how i wanted it π the audacity. the disrespect. anyway.
Otherwise, keyok returns OK. and we love an OK. π
π₯ EXTENSIONS π₯
keyok is an ncurses extension. periodt. that's the whole section. π
πΈ PORTABILITY πΈ
if your application is out here employing ncurses extensions, you should condition their use on the visibility of the NCURSES_VERSION preprocessor macro. that's the move. don't just assume, bestie β check first. π§
also, for the record: NetBSD curses since 2.0 (2004) supports keyok. so it's not just an ncurses-exclusive thing, it's been around. vintage. β¨
π AUTHORS π
Thomas Dickey
(thank you king, we appreciate you π«Ά)
π SEE ALSO π
curses(3X)define_key(3X)keybound(3X)keyok(3X)key_defined(3X)
go read those next, they're all part of the same friend group iykyk π¦
and that's the whole page, bestie!! π this was ncurses 6.6, dated 2025-10-04, and honestly it ate. now go forth and enable/disable your function keys with intention. mwah π πβ¨
π¦ 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-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