Skip to content

Fix/window panel - #11

Merged
donk8r merged 4 commits into
masterfrom
fix/window-panel
Jun 6, 2026
Merged

Fix/window panel#11
donk8r merged 4 commits into
masterfrom
fix/window-panel

Conversation

@donk8r

@donk8r donk8r commented Jun 6, 2026

Copy link
Copy Markdown
Member

No description provided.

donk8r added 4 commits June 4, 2026 19:48
- Update keyboard listener to trigger overlay on Cmd+Shift+P
- Update README and INSTRUCTIONS documentation
- Update address bar tooltip and welcome toast
- Update internal code comments referencing the shortcut
- Replace hardcoded shortcuts with a data-driven Keymap system
- Add support for recording, resetting, and persisting custom bindings
- Implement macOS virtual keycode translation and chord validation
- Create a dedicated keybindings configuration tab in settings
- Add capture mode for recording shortcuts without triggering actions
- Implement context-aware event mapping for different UI states
- Replace static shortcut displays with live data rendering
- Sync Command Palette and AI Editor badges with the live keymap
- Add IPC handlers for keybinding recording and reset actions
- Implement UI metadata export for settings and help overlays
@github-actions

github-actions Bot commented Jun 6, 2026

Copy link
Copy Markdown

Octomind — developer:brief (octohub:glm)

Now I have all the context I need. Let me write the brief.

## 📦 Brief: Configurable keybindings system + command palette shortcut change + tab bounds fix + quickslots height fix
**Overall risk:** 🟡 MEDIUM · **Cards:** 4

| # | Change | Risk | Confidence |
|---|--------|------|------------|
| 1 | Replaces hardcoded keyboard shortcuts with a data-driven, user-configurable Keymap system persisted to disk | 🟡 | ●●● |
| 2 | Changes command palette shortcut from ⌘K to ⌘⇧P across all UI surfaces | 🟢 | ●●● |
| 3 | Fixes tab WebView bounds on switch — re-applies geometry to prevent footer overlap | 🟢 | ●●● |
| 4 | Sets quickslots bar height to 36px (was `100%`) | 🟢 | ●●● |
Card 1/4: Data-driven configurable keybindings replace hardcoded shortcut dispatch · 🟡 · ●●●

INTENT
Replace the 170-line hardcoded if cmd && keycode == X chain in the NSEvent monitor with a Keymap struct that loads defaults, overlays user overrides from ~/.config/octoweb/keybindings.json, and supports runtime remapping via a new Settings → Keybindings tab. Every remappable shortcut now resolves through a single O(1) lookup table.

WHAT CHANGED

  • New keybindings.rs module (566 lines): Action enum (24 actions), Chord parser, Keymap with load/rebind/reset/reset_all/persist/ui_json, persisted as JSON
  • NSEvent monitor now builds a u8 modifier bitset, reads keymap.lookup(mods, keycode), then dispatches via keybind_to_event() — a context-aware match that returns None for suppressed actions (e.g. scrolling while overlay is open), letting the key fall through to the WebView
  • Settings modal gains a tabbed UI (General / Keybindings) with chord capture, conflict detection, per-action reset, and "Reset all"
  • Shortcuts overlay (⌘/) now renders its Global column dynamically from Keymap::ui_json() instead of hardcoded HTML
  • keybind_capturing atomic gates the NSEvent monitor — when the settings panel is recording a chord, all shortcuts are suppressed so the WebView can capture the raw keypress
  • 4 new AppEvent variants: KeybindRecord, KeybindReset, KeybindResetAll, KeybindCapture
  • shortcuts_wv renamed from _shortcuts_wv — it's now used for live keybinding injection

IMPACT RADIUS

  • Every global keyboard shortcut in the app now routes through Keymap — any bug in Chord::parse, Keymap::rebuild, or keybind_to_event affects all shortcut-driven behavior
  • Settings IPC handler, shortcuts overlay, and NSEvent monitor are tightly coupled through the sync_keybindings! macro and keybind_capturing atomic
  • Keymap is wrapped in Arc<RwLock<_>> and read on every keystroke via km.read() inside the NSEvent callback — this lock is on the main run loop's thread, but the callback itself runs on the main thread too (NSEvent local monitor), so contention is unlikely

RISK
🟡 MEDIUM. The RwLock read in the NSEvent callback (km.read()) is taken on every keypress. If a settings-side rebind or reset (which takes a write lock) ever blocks the main thread long enough, keystrokes could feel laggy. In practice the write lock is held for a HashMap rebuild + JSON serialize, which is sub-millisecond — but a poisoned lock from a panic would silently disable all shortcuts until restart (the .ok() on the read swallows the error). Also, Chord::parse rejects chords with no modifier — but the error message "Add at least one modifier" is only shown in the settings UI, not surfaced if a corrupt keybindings.json file has an entry that fails to parse (it's silently dropped by effective_chord.ok()).

DIVERGENCE
🧩 Incomplete changeKeymap::persist uses atomic write-then-rename, but there's no migration or validation on load. A malformed keybindings.json (e.g. an action ID that was removed in a future version) is silently accepted into overrides and will fail Action::from_id on rebind/reset, but won't cause rebuild to fail (unknown IDs just produce no lookup entry). This is benign but means stale entries accumulate in the file forever.

📎 Source

Card 2/4: Command palette shortcut changed from ⌘K to ⌘⇧P · 🟢 · ●●●

INTENT
Change the command palette trigger from ⌘K to ⌘⇧P to free up ⌘K for potential future use and align with the new configurable keybindings system where the default is now cmd+shift+p.

WHAT CHANGED

  • Default chord for CommandPalette action is cmd+shift+p (was hardcoded as ⌘K)
  • All user-facing references updated: address bar tooltip, new tab page subtitle, welcome toast, overlay module doc comment, inline edit focus-retry comment, README, INSTRUCTIONS

IMPACT RADIUS
Isolated — the shortcut is user-remappable now, so anyone who preferred ⌘K can rebind it. The string change is cosmetic and consistent across all surfaces.

RISK
🟢 LOW. Muscle memory break for existing users, but the keybindings system lets them change it back. No functional risk.

📎 Source

Card 3/4: Tab WebView bounds reset on switch to prevent footer overlap · 🟢 · ●●●

INTENT
Fix a visual bug where switching to a tab created at a different window size would show stale bounds — leaving a gap above or letting the quickslots footer paint over the page content.

WHAT CHANGED

  • On SwitchTab, before making the target tab visible, set_bounds is called with the current window's content area dimensions (address_bar_h to height - address_bar_h - footer_h)

IMPACT RADIUS
Isolated to tab switching. Only affects the visual rect of the WebView — no state or data changes.

RISK
🟢 LOW. The bounds are recomputed from live window dimensions on every switch. The saturating_sub prevents underflow. No risk beyond the fix itself.

📎 Source

Card 4/4: Quickslots bar height fixed to 36px · 🟢 · ●●●

INTENT
Fix the quickslots footer bar from stretching to full viewport height (100%) to its intended compact row height.

WHAT CHANGED

  • #bar CSS height changed from 100% to 36px

IMPACT RADIUS
Isolated — only affects the quickslots footer bar visual height.

RISK
🟢 LOW. One-line CSS fix. No behavioral change.

📎 Source

📂 Files changed (10 files, ~1108 lines)

{tokens:479053,cost:0.488667}

@donk8r
donk8r merged commit b950d73 into master Jun 6, 2026
6 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant