1 Home
liquibyte edited this page 2026-11-19 16:23:30 -06:00

Hosho API reference

Hosho is a C library that is a terminal without a display. It runs a program on a pseudoterminal, reads what the program writes, and keeps the screen that program expects. It has no display and no toolkit: it needs only libc. A host draws the screen and sends the keys, so a terminal can be a widget in any program. A terminal widget for X11 programs built on Xtk comes with it.

It answers as a VT420 with color, and does what xterm does and more: text wrapped again on a resize, hyperlinks, links found in the text, search, marks of the shell with each command's result, pictures, and themes.

The guides explain how the parts fit and how to use them:

  • Overview: what Hosho is, its layers, building and installing
  • Embedding the Widget: a complete example program and every call of the widget
  • The Widget in Use: what the user can do in the widget: keys, mouse, menu, search, links
  • Writing a Host: the library without the widget: the event loop, the screen, drawing, the questions about the text
  • The Host Functions: every function a host gives the terminal, and the settings a host makes
  • Themes: the theme file and each of its keys
  • Keyboard, Mouse and Paste: what a key, the mouse and a paste send, and the keyboard protocols
  • Shell Integration: the file for each shell, and what the marks give
  • Pictures: sixel, iTerm2's inline images and the Kitty graphics protocol, and the jail that takes them apart
  • Control Functions: each control function the terminal does

The other pages are the API: each header is a page, with its types, constants and functions, and what each parameter and return value means. They are generated from the Doxygen comments in Hosho's headers (src/*.h).

Version 1.5.

The whole library

  • hosho.h - Hosho, a Terminal Without a Display

From bytes to a screen

For the host that shows it

  • hosho_text.h - Questions About the Text on the Screen: Ranges, Search, Links, Command Blocks
  • hosho_input.h - Input Encoder: Keys, Mouse, Focus and Paste as the Bytes a Program Reads
  • hosho_theme.h - Terminal Themes: Every Color and Setting of the Display

The program