#[non_exhaustive]pub enum Event {
Key(KeyEvent),
Mouse(MouseEvent),
Resize(u16, u16),
Close,
ThemeChanged(SystemTheme),
Paste(String),
FocusGained,
FocusLost,
Custom(u64),
}Expand description
Terminal input event.
Variants (Non-exhaustive)§
This enum is marked as non-exhaustive
Key(KeyEvent)
Keyboard event.
Mouse(MouseEvent)
Mouse event.
Resize(u16, u16)
Terminal window resized.
Close
Window closed.
ThemeChanged(SystemTheme)
The system’s light/dark color-scheme preference changed, or was determined for the first time at startup.
Only backends with a real source of truth for this emit it: the
windowed (winit) backend, on both native and wasm (winit’s web
target derives it from the browser’s prefers-color-scheme media
query, including live updates). Character-mode backends (crossterm)
have no equivalent free API – see the windowed backend’s own docs
for why – and never emit this; an app that wants a default should
pick one itself rather than waiting for an event that may never
arrive.
Paste(String)
Pasted text, delivered as a single event rather than individual key presses.
Not emitted by all backends – see each backend’s own docs for whether and how it sources this. Content is forwarded verbatim from the source, including embedded newlines; the receiving app is responsible for any filtering it needs.
FocusGained
The terminal or application window gained input focus.
This reflects OS/terminal-level focus, not in-app widget focus (see
retroglyph-widgets’ focus ring for that).
FocusLost
The terminal or application window lost input focus.
This reflects OS/terminal-level focus, not in-app widget focus (see
retroglyph-widgets’ focus ring for that).
Custom(u64)
An application-defined event injected from outside the normal input source (e.g. a network, audio, or timer thread), carrying an opaque tag the app assigns its own meaning to.
Only emitted by backends with a real cross-thread injection point:
the windowed (winit) backend’s EventProxy
(retroglyph_window::winit::EventProxy::send_event), which forwards
the u64 unchanged. The payload is deliberately a plain u64
rather than an arbitrary boxed value: it keeps Event cheaply
Clone/PartialEq/Eq/Hash (a Box<dyn Any> could not derive
any of those) and needs no generic parameter threaded through every
crate that names Event. Treat it as a correlation id – look up
the real payload in whatever shared state or channel the sending
thread already placed it in.