Skip to content

[CTX-0153] feat(ux): keymap-driven chrome keys - #256

Merged
Xuepoo merged 1 commit into
mainfrom
carryctx/ctx-0153
Sep 4, 2026
Merged

Xuepoo merged 1 commit into
mainfrom
carryctx/ctx-0153

Conversation

@Xuepoo

@Xuepoo Xuepoo commented Sep 3, 2026

Copy link
Copy Markdown
Contributor

Closes #249. Task: CTX-0153.

Problem

main.rs routed every KeyboardInput to Runtime (PTY bytes) AND THEN consumed Tab/arrows/n/p/1-8 for pane focus with no modifier check and no keymap. Tab both completed and moved focus; arrows moved cursor and focus; Ctrl+P (0x10 via CTX-0154) also triggered Prev-focus. No user keymaps existed (config keymaps stub).

Fix (single-owner rule: each key event has exactly one consumer)

  • bitty-config keymap module (new): Chord/KeyName/ChromeAction schema, ghostty-derived 21-entry defaults (alt+h/j/k/l + ctrl+alt+arrows navigate, ctrl+tab cycle, shift+alt create, shift+ctrl resize, alt+w close, alt+m/f zoom). Plain Tab/arrows/letters/digits/Ctrl+P stay unbound (shell). User entries override by context+chord identity. Unknown actions/chords/contexts fail closed; wired into KeymapEntry::validate so plan/merge/config-check all reject.
  • bitty-app: pre-routing intercept before Runtime (app modifier mirror: KeyEvent carries no modifiers; modifier-only keys + ModifiersChanged always route so both trackers sync). Bound chord => chrome action, PTY never sees it; repeats of bound chords suppressed. Old focus matcher deleted. Focus/split/close/resize/zoom via existing Runtime/LayoutNode APIs only.
  • CLI-first introspection (DEC-0007): config check prints per-entry rows with file/default attribution; starter init.lua documents keymaps.

Coordination (CTX-0154)

Single-owner rule implemented on this side as required: Ctrl+P is shell-only unless bound (verified by default-table test).

Validation

  • just check pieces green: fmt, clippy -D warnings, actionlint, act -n, markdownlint 0 issues.
  • cargo test --workspace --all-targets --locked: 66 targets green (bitty-config 92, bitty-app 48 incl. new single-owner/surgery tests).
  • cargo check --target x86_64-pc-windows-gnu: green. No TODO/FIXME, MSRV-safe (no let-chains).
  • Live Hyprland 0.56.2 ws4 (focus by address, wtype, grim full + window-crop, close + restore ws3): od child shows 09 for Tab (no chrome lines); alt+l/h move focus 1<->2; alt+w closes 2->1; fish completes ec->echo with autosuggest alive; Tab/Left produce no focus change.
  • Screenshots: recording/evidence/ctx-0153-od-tab(-09-crop).png, ctx-0153-split-focus.(png,-crop), ctx-0153-fish-complete.(png,-crop), ctx-0153-close-view.(png,-crop).

Remaining risks

  • Branch is carryctx/ctx-0153 per task worktree (not ctx-0153/feat-* convention); worktree hook prepended stale [CTX-0135] twice (repaired; worktree rebound to CTX-0153, but active session still CTX-0135 - commander may rebind).
  • Super-chord matching relies on app mirror (Runtime ignores super); compositor may intercept first.
  • keymaps reload class is Live but no hot-reload wiring exists (startup-only; follow-up).
  • Single-PT Y panes: new splits are views of one shell (matches --split today).

Priority: P0 | Area: ux | Labels: fix,area:ux,P0 | Milestone: v0.1.0 | RFC: - | Task: CTX-0153

Single-owner rule: bound chords are consumed by chrome actions and never
reach the PTY; unbound keys (Tab, arrows, plain letters/digits, Ctrl+P)
always go to the shell. Removes the main.rs focus matcher that stole
Tab/arrows/n/p/1-8 with no modifier check and no keymap.

bitty-config: new keymap module (Chord/KeyName/ChromeAction schema,
ghostty-derived 21-entry defaults, resolve with user override by
context+chord identity, fail-closed validation wired into
KeymapEntry::validate so plan/merge/config-check all reject unknown
actions, chords, and contexts).

bitty-app: pre-routing intercept with app modifier mirror (KeyEvent
carries no modifiers), focus/split/close/resize/zoom via existing
Runtime/LayoutNode APIs only, per-entry config check rows, starter
init.lua keymap docs.

Live (Hyprland ws4): od shows 09 for Tab, alt+h/l move focus 1<->2,
alt+w closes 2->1, fish completes ec->echo with autosuggest alive.
Screenshots: recording/evidence/ctx-0153-*.png (full + window-crop).

Task: CTX-0153. Issue: #249.
@Xuepoo Xuepoo added fix Bug fix area:ux labels Sep 3, 2026
@Xuepoo Xuepoo added this to the v0.1.0 milestone Sep 3, 2026
@Xuepoo Xuepoo added the P0 Priority: highest label Sep 3, 2026
@Xuepoo
Xuepoo merged commit 66e8902 into main Sep 4, 2026
10 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

area:ux fix Bug fix P0 Priority: highest

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Wire config keymaps to split/panel management; stop stealing Tab from the shell

1 participant