package miaou-driver-matrix

  1. Overview
  2. Docs

Module Miaou_driver_matrix.Matrix_inputSource

Terminal input handling for the Matrix driver.

A dedicated Eio fiber reads keyboard and mouse input from the terminal, parsing escape sequences into events which are pushed into a mutex-protected queue. The main tick loop drains the queue each tick, giving sub-millisecond input latency regardless of TPS.

Lifecycle: create -> start -> (main loop calls drain) -> stop.

Sourcetype t

Input reader state.

Sourceval create : ?handle_sigint:bool -> Matrix_terminal.t -> t

Create a new input reader for the given terminal. Does not start the reader fiber — call start for that.

  • parameter handle_sigint

    If false, SIGINT (Ctrl+C) is not intercepted, allowing the app to receive it as a key event. Default: true

Sourceval start : t -> unit

Start the background reader fiber. Must be called after entering terminal raw mode, from inside an Eio switch (uses Miaou_helpers.Fiber_runtime.spawn).

Sourceval stop : t -> unit

Signal the reader fiber to stop.

Sourceval drain : t -> Matrix_io.event list

Drain all pending events from the queue (oldest first). Returns the empty list when nothing is buffered.