Expand description
Application state and event loop.
Everything that reads or changes scx.service goes through the
backend, which is scxcli. The app holds the last listing it got
back, the kernelβs own view read every tick, and the selections of
the three views.
Re-exportsΒ§
use std::time::Duration;πuse std::time::Instant;πuse anyhow::Result;πuse ratatui::DefaultTerminal;πuse ratatui::crossterm::event;πuse ratatui::crossterm::event::Event;πuse ratatui::crossterm::event::KeyCode;πuse ratatui::crossterm::event::KeyEvent;πuse ratatui::crossterm::event::KeyEventKind;πuse ratatui::crossterm::event::KeyModifiers;πuse crate::backend::Backend;πuse crate::kernel;πuse crate::kernel::KernelState;πuse crate::logs;πuse crate::logs::LogLine;πuse crate::model::DEFAULT_ID;πuse crate::model::Installed;πuse crate::model::Listing;πuse crate::model::Pick;πuse crate::model::validate_arg;πuse crate::system::system_command;πuse crate::ui;πuse crate::watch::Watcher;π
StructsΒ§
- App
- Input
- A single-line text field. The cursor is counted in characters, so editing multi-byte input stays sound; the UI derives its cursor block from the same count.
- Message
EnumsΒ§
- Pending
Action π - Deferred user actions: queued by key handlers, executed by the event loop right after the frame announcing them has been drawn. scxcli blocks (a restart waits for the unit to come up, pkexec may prompt), so the UI must show feedback before the call starts.
- View
- Which screen is shown.
ConstantsΒ§
- ACTION_
DEBOUNCE π - Minimum spacing between two scheduler-affecting actions. Linux
terminals deliver key autorepeat as plain
Pressevents, so without this, holding Enter would fire one start per repeat. - MESSAGE_
TTL π - How long informational messages stay in the message bar. Errors are exempt: they are actionable and stay until replaced.
- REFRESH_
EVERY π - Slow poll for what inotify cannot see: the unitβs state and the process behind it. The catalog and environment files are refreshed on inotify events instead.
- TICK π
- How often the input poll wakes up to redraw / refresh.
FunctionsΒ§
- is_
running - Whether
idis the entry that runs, for the listsβ marker: the running schedulerβs name, ordefaultwhile the kernelβs own runs. - is_
selected - Whether
idis what the next start would run, for the listsβ second marker: a selection that is stopped or failed. - step π