Skip to content

mecatui: live-reload operator settings (keymap) without restart #456

Open

Description

@jbeda

Problem

mecatui reads the operator-tier keymap: overrides from ~/.config/mecatl/settings.yaml exactly once at startup — applyKeyOverridesToDeps in cmd/mecatui/main.go runs before tea.NewProgram, bakes the result into ui.Deps.KeyOverrides, and ui.New applies it at construction (model.go). There is no re-read path: no fsnotify watch, no /reload palette command, no signal handler. An operator who edits settings.yaml must quit and relaunch mecatui to pick up a keybinding change.

Why it's worth fixing

Keybinding remapping is an iterative, taste-driven activity — an operator trying to find a comfortable home for Agents/Effort (e.g. to free ctrl+a/ctrl+e for line editing, see #455) will want to try a chord, feel it, and adjust. A full restart per iteration is friction that discourages the very configurability the feature offers.

Possible shapes (design TBD)

  • A /reload palette command that re-reads settings.yaml, re-validates the keymap, and swaps m.keys in place (rebuilding help markings).
  • An fsnotify watch on the settings file that does the same automatically on save.
  • Either must handle: an invalid edited file (keep the last-good keymap + surface a loud warning, don't crash or drop bindings), and chords whose action is mid-overlay (e.g. remapping CancelChild while the agents overlay is open).

Scope note

The validator (keymap.Parse/keymap.Validate) and the override application (applyKeyOverrides) already exist and are pure — the work is the reload trigger + safe in-place swap + a warning surface, not new keymap machinery. See #455 for the documentation side of the keymap feature.

Activity

  1. added
    tui
    on Aug 13, 2026
  2. jbeda commented on Aug 19, 2026

    @jbeda
    ContributorAuthor

    Design note from the surface work (#555): the modal/surface interface holds its shared ambient deps (theme/keys/marks/caps) on the surface state, built once at Open, and we deliberately treat them as immutable-after-startup. When live-reload lands, the surface layer will need a 'deps updated' fan-out (a DepsChanged event or a re-derive at Render) so an open modal picks up new theme/keys/caps without losing its view state. Banked as a surface-migration follow-up; see docs/design/surface-migration-plan.md decision 8.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    tui

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions