class Obsctl::TUI::Dispatcher

Defined in:

obsctl/tui/dispatcher.cr

Constant Summary

DEFAULT_PAGE_STEP = 5

Half-page steps need to know how tall the focused panel is. The area is read through a proc rather than stored because it changes with every resize, and asking at the moment of the keypress is what keeps the step matched to what is on screen.

FOCUS_ACTIONS = {ActionKind::FocusScenes => ->(model : Model) do model.focus = FocusPanel::Scenes end, ActionKind::FocusAudio => ->(model : Model) do model.focus = FocusPanel::Audio end, ActionKind::FocusProfiles => ->(model : Model) do model.focus = FocusPanel::Profiles end, ActionKind::FocusCollections => ->(model : Model) do model.focus = FocusPanel::Collections end, ActionKind::FocusPaneLeft => ->(model : Model) do model.focus = model.focus.left end, ActionKind::FocusPaneRight => ->(model : Model) do model.focus = model.focus.right end, ActionKind::FocusPaneUp => ->(model : Model) do model.focus = model.focus.up end, ActionKind::FocusPaneDown => ->(model : Model) do model.focus = model.focus.down end}

Actions that only move focus or the cursor, with no daemon round trip.

HELP_WORDS = ["h", "help"]
PALETTE_LEADERS = "/:"

The palette accepts either leader, so the line is read without one and the vim spellings of quit and help are answered before the registry is consulted.

POINTER_KINDS = [ActionKind::PointerFocus, ActionKind::PointerActivate, ActionKind::PointerToggleMute, ActionKind::PointerVolumeUp, ActionKind::PointerVolumeDown]
QUIT_WORDS = ["q", "q!", "qa", "qa!", "quit", "quit!", "exit", "x", "wq"]
SETTINGS_ALIASES = ["themes", "theme", "settings"]

themes is a dashboard-only view, so it has no registry entry and is appended to the generated list.

TUI_PAYLOAD_OVERRIDES = {Domain::StatusCommand => "get_snapshot", Domain::ConnectCommand => "reconnect_obs"}

Where the dashboard deliberately asks for something other than the command's default IPC name.

/status in the palette should refresh the panels rather than print a report, and /connect is a request to re-establish the OBS link.

VOLUME_DEBOUNCE = 120.milliseconds

Constructors

Instance Method Summary

Constructor Detail

def self.new(model : Model, sender : Sender, theme_persister : ThemePersister | Nil = nil, volume_debounce : Time::Span = VOLUME_DEBOUNCE, viewport : Viewport | Nil = nil) #

[View source]

Instance Method Detail

def handle(action : Action) : ActionOutcome #

Every action ends the sequence that produced it; only a fresh prefix leaves one pending. Clearing here rather than in each branch is what guarantees the which-key menu closes on whatever the next key does.


[View source]