feat(terminal): add Capture toggle routing shortcut keys to the PTY #90
Loading…
Reference in a new issue
No description provided.
Delete branch "feat/VAPP-82-terminal-capture-toggle"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
Mirror the Desktop Capture button (VAPP-49) on the Terminal toolbar. A new Capture toggle arms a
capturesignal and, on the wasm side, aset_capturemethod onTermHandle. While capture is on, xterm'sattachCustomKeyEventHandlerhookpreventDefaults browser chord keys (Ctrl/Meta/Alt-modified keys and function keys like F5) and still returns true so xterm encodes the key and forwards it to the PTY; this is the always-available layer and the Firefox fallback. On Chromium the Keyboard Lock API (navigator.keyboard.lock()) is additionally engaged so browser-reserved keys (Ctrl+W/Ctrl+T) and Escape are captured in fullscreen; it is feature-detected vianavigator.keyboardand a clean no-op elsewhere. Pressing Esc (or toggling off) releases capture, disarming interception and flipping the toolbar signal back to Off through an on-capture-off callback, matching the Desktop Esc-release behavior. The lock is also released on window blur and on teardown. The tooltip states the browser boundary: OS/WM keys (Alt+Tab, Super, Ctrl+Alt+F1) can never be captured by any browser.Add a terminal_capture_guard test module that scans terminal.rs and fails the build if the toggle, custom key handler, preventDefault, Keyboard Lock engage/feature-detect, Esc-release, or the WM-key tooltip disappears, enforcing the invariants mechanically like the VAPP-80 detach guard.
#VAPP-82
Co-Authored-By: Claude Opus 4.8 (1M context) noreply@anthropic.com