feat(terminal): add an embedded terminal panel - #1089
spandan11106 wants to merge 6 commits into
Conversation
Add a window-scoped terminal panel below the browser, toggled with F4. The shell spawns on first reveal in the active local folder and survives hiding and navigation; the close control ends the session so the next reveal starts fresh wherever the browser has moved to. While VTE holds focus it owns keyboard input, so file shortcuts cannot act on the browser behind it. Colors, selection and font follow the active theme; a theme's own syntax colors fill the ANSI palette when it carries a real spread of hues, otherwise VTE's sixteen stay in place so diff and ls output remains readable. Ctrl+T and the external terminal behavior are unchanged. Refs lgse#93
screenrecording-2026-09-17_18-04-43.mp4 |
|
Really nice work overall. This is very close to the direction we discussed in #93. The window-scoped VTE panel, F4 toggle, keyboard ownership, separation from the existing external terminal, lazy spawn, packaging updates, and keeping cwd synchronization out of this PR all look aligned with the proposed foundation. I tested the current head locally and found two blocking issues that I think we should fix before merging, plus one missing test case: 1. Non-native locations can open the terminal in Strata's process cwd
In VTE, a missing working directory means the child inherits the application's cwd, so the embedded terminal ends up opening in an unrelated local directory. I reproduced this from Trash: pressing F4 successfully opened the terminal, and I think The same consideration applies to a native path that cannot be represented in the format VTE expects. Silently inheriting Strata's cwd would be misleading there too. How to reproduce
pwd
I recorded a video showing this reproduction and attached it below. bug-1.mp42.
|
VTE inherits the application's working directory when it is spawned without one, so Trash and other locations with no native path opened a shell in whatever directory Strata was running from. A directory that cannot be represented as UTF-8 fell through the same path. The panel now treats a missing directory as "no session here": it reveals itself with a line saying the terminal is only available for local folders and spawns nothing. Ctrl+T keeps reporting its own error for those locations. The panel also held itself alive. Its child-exited handler, its close button and its spawn completion callback all captured the panel, so the state outlived the window that owned it. All three now hold a weak reference, with a regression test over the drop. Adds end-to-end coverage across the real PTY boundary: a shell runs in the browsed directory and survives hiding the panel, and a location without a local path starts no shell at all. Refs lgse#93
|
Thanks for the thorough pass, and for the reproductions — both blockers were real and both are fixed. 1. Non-native locations could open a terminal in Strata's cwdConfirmed and fixed.
2. Strong Rc cycles kept
|
The panel resolved its folder the way Ctrl+T does, which in Columns mode prefers the pointer-hovered column. Opening it after clicking into a subfolder could therefore start the shell in the parent the pointer happened to rest on rather than the folder the window says it is showing. It now follows the active location. Refs lgse#93
Description
Adds a window-scoped embedded terminal below the browser, toggled with
F4. This is the first of the three steps sketched in #93: a provider-agnostic terminal foundation, with browser-to-terminal cwd synchronisation and the AI agent actions to follow as separate changes.vte4provides the terminal; no PTY or emulation code of our own.F4hides and shows the panel without disturbing the session. The×in the panel header ends it, so the next reveal starts a fresh shell wherever the browser has moved to. Typingexitdoes the same.Delete,Ctrl+C,Ctrl+Vand the arrows cannot act on files behind the panel.git diffandlsoutput unreadable.Ctrl+Tand the external-terminal behavior are unchanged, and remain the fallback for locations the panel cannot open.Not included, deliberately: the terminal does not follow navigation. Injecting
cdinto a live shell needs a reliable signal that the shell is at a fresh, empty prompt, which VTE only provides from 0.80 — later than the version on the current base image. That work is tracked in #1103. A new session still starts in the folder being browsed, and closing the session re-targets the next one.Visual evidence
Posted in a comment below: toggling with
F4, resizing, the session surviving hide and show, and live theming.How to test
vte4on Arch,libvte-2.91-gtk4-devon Debian/Ubuntu) and build.F4. The panel opens with a shell already in that folder.ls,pwd), drag the divider to resize, then pressF4twice. The same session comes back with its scrollback intact.DeleteandCtrl+A. Neither touches the file listing behind the panel.×in the panel header, then pressF4again. A fresh shell starts in the folder you moved to.Ctrl +/Ctrl -.Ctrl+Tand confirm the external terminal still opens as before.Expected result: the panel opens in the active folder, survives hiding and navigation, releases every key to the shell while focused, restarts in the current folder after being closed, and repaints with the rest of the interface when the theme or text size changes.
Related issue
Refs #93
This is the first of the three changes planned on that issue, so it does not close it. #93 stays open until the AI agent actions land on top of this terminal.