#[non_exhaustive]pub struct RunConfig {
pub tick_rate: Duration,
pub mouse: bool,
pub kitty_keyboard: bool,
pub theme: Theme,
pub color_depth: Option<ColorDepth>,
pub max_fps: Option<u32>,
pub scroll_speed: u32,
pub title: Option<String>,
}Expand description
Configuration for a TUI run loop.
Pass to run_with or run_inline_with to customize behavior.
Use Default::default() for sensible defaults (16ms tick / 60fps, no mouse, dark theme).
§Example
use slt::{RunConfig, Theme};
use std::time::Duration;
let config = RunConfig::default()
.tick_rate(Duration::from_millis(50))
.mouse(true)
.theme(Theme::light())
.max_fps(60);Fields (Non-exhaustive)§
This struct is marked as non-exhaustive
Struct { .. } syntax; cannot be matched against without a wildcard ..; and struct update syntax will not work.tick_rate: DurationHow long to wait for input before triggering a tick with no events.
Lower values give smoother animations at the cost of more CPU usage. Defaults to 16ms (60fps).
mouse: boolWhether to enable mouse event reporting.
When true, the terminal captures mouse clicks, scrolls, and movement.
Defaults to false.
kitty_keyboard: boolWhether to enable the Kitty keyboard protocol for enhanced input.
When true, enables disambiguated key events, key release events,
and modifier-only key reporting on supporting terminals (kitty, Ghostty, WezTerm).
Terminals that don’t support it silently ignore the request.
Defaults to false.
theme: ThemeThe color theme applied to all widgets automatically.
Defaults to Theme::dark().
color_depth: Option<ColorDepth>Color depth override.
None means auto-detect from $COLORTERM and $TERM environment
variables. Set explicitly to force a specific color depth regardless
of terminal capabilities.
max_fps: Option<u32>Optional maximum frame rate.
None means unlimited frame rate. Some(fps) sleeps at the end of each
loop iteration to target that frame time.
scroll_speed: u32Lines scrolled per mouse scroll event. Defaults to 1.
title: Option<String>Optional terminal window title (set via OSC 2).
Implementations§
Source§impl RunConfig
impl RunConfig
Sourcepub fn kitty_keyboard(self, enabled: bool) -> Self
pub fn kitty_keyboard(self, enabled: bool) -> Self
Enable or disable Kitty keyboard protocol.
Sourcepub fn color_depth(self, depth: ColorDepth) -> Self
pub fn color_depth(self, depth: ColorDepth) -> Self
Override the color depth.
Sourcepub fn scroll_speed(self, lines: u32) -> Self
pub fn scroll_speed(self, lines: u32) -> Self
Set the scroll speed (lines per scroll event).