Repository navigation
fix: stop the shell behaving like a browser - #99
Merged
Merged
Conversation
The --app window is a browser only by construction, and its reflexes leaked into every screen that is not a focused terminal — a terminal already swallows them through xterm's own preventDefault, which is why they only ever misfired elsewhere. Two of them were fatal. Ctrl+W closed the window, and a closed window quits lich. Dropping a file on the window navigated to it, replacing the app with the file's contents, with no address bar to come back from. The rest were noise with real teeth: Ctrl+T and Ctrl+N spawned tabs and windows, Ctrl+P/S/O opened dialogs with nowhere to land, Ctrl+U, Ctrl+H and Ctrl+J opened browser surfaces, Ctrl+Shift+Delete would have wiped lich's own localStorage settings along with the browsing data, the right-click menu offered Back, Reload, Save as and View source, a middle-clicked link spawned a browser window, and a browser locale that did not match the UI raised the translate bubble on startup. Chromium's translate feature is now switched off at launch, and lib/browser-defaults.ts refuses the rest before React mounts. Swallowing is preventDefault and never stopPropagation: a terminal must still receive every chord as its PTY sequence, since most of these are real terminal bindings (Ctrl+W kills a word, Ctrl+U a line, Ctrl+D is end-of-file, Ctrl+P walks shell history). Kept on purpose: reload (it recovers a wedged UI and costs nothing — the session lives in the backend), the devtools chords, F11, and the terminal's own right-click menu, which is where its Copy and Paste live.
This was referenced Jul 25, 2026
Merged
omartelo
added a commit
that referenced
this pull request
Jul 27, 2026
The shifted list was enumerated from the tab and window commands, plus the browsing-data wipe, and stopped there — so Shift became a way past the refusal rather than part of it. Ctrl+P was refused while Ctrl+Shift+P still raised the system print dialog, Ctrl+O while Ctrl+Shift+O still opened the bookmark manager, and Ctrl+Shift+Q exited Chromium outright, which quits lich exactly as Ctrl+W did before #99 stopped it. Shift does not make a chord harmless; it only changes which surface opens. They fired on every screen, a focused terminal included, since xterm only preventDefaults the chords it encodes as a PTY sequence and none of these are one. Ctrl+Shift+B and Ctrl+Shift+A are deliberately still live: an --app window has no bookmarks bar and no tabstrip, so both are no-ops here, confirmed by hand.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
The
--appwindow is a browser only by construction, and its reflexes leakedinto every screen that is not a focused terminal — a terminal already swallows
them through xterm's own
preventDefault, which is why they only ever misfiredelsewhere.
Two of them were fatal:
file's contents, with no address bar to come back from. Easy to trigger by
dragging a file at a terminal expecting to paste its path.
The rest were noise with real teeth:
lich.*localStorage settings with the browsing dataonClicknever sees an aux click)What changed
internal/chromium: launch with--disable-features=Translate.frontend/src/lib/browser-defaults.ts(new): the chord table, the context-menurule and the drop guard, installed from
main.tsxbefore React mounts.Markdown.tsx:onAuxClickrefuses the middle-click navigation the existingonClickhandler could not see.Swallowing is
preventDefaultand neverstopPropagation: a terminal muststill receive every chord as its PTY sequence, since most of these are real
terminal bindings — Ctrl+W kills a word, Ctrl+U a line, Ctrl+D is end-of-file,
Ctrl+P walks shell history.
Kept on purpose
Reload (Ctrl+R / F5) recovers a wedged UI and costs nothing, since the session
lives in the backend; the devtools chords and F11 are worth more than the
purism; and the terminal keeps Chromium's right-click menu, which is where its
Copy and Paste live. Ctrl+F outside a terminal still opens Chromium's find bar —
searching the page is useful, and it is easy to add to the table later.
Test plan
gofmt -l .,go vet ./...,go test ./...— 400 passpnpm test— 416 pass, incl. the newbrowser-defaultstablepnpm build,pnpm checktask dev. Chromium marks some acceleratorsreserved, and a reserved key cannot be cancelled by the page — Ctrl+W was
the open question. It is not reserved in an
--appwindow: the chord isrefused and the window stays open.