Conversation
The integrated terminal inherits the environment of the process that started SideX, so a CLI launch hands the launching shell's session state to every shell it spawns while a menu launch starts from the clean desktop session environment. With a gnome-terminal launch that includes VTE_VERSION. The spawned login shell then runs /etc/profile.d/vte-2.91.sh, which appends to PROMPT_COMMAND when it is an array and overwrites it otherwise. A prompt framework initialised earlier from /etc/profile.d leaves it a plain string, so the overwrite wins and the prompt falls back to the distro default while the rest of the shell config still applies. Drop the session-scoped variables before spawning. VTE_VERSION should never have been forwarded in any case: the terminal renders through xterm.js, not VTE.
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.
Fixes #112
What happens
The integrated terminal inherits the environment of whatever process started SideX. Launched from a terminal, that environment carries the launching shell's session state into every shell SideX spawns; launched from the desktop menu, it starts from the clean session environment.
CommandBuilderseeds its environment fromstd::env::vars_os(), and the env map the frontend sends is built from the same process environment, so nothing filtered it on either path.On the reporter's system the variable that matters is
VTE_VERSION, exported by gnome-terminal. The spawned login shell reads/etc/profile, which sources/etc/profile.d/*.shin alphabetical order:starship.shsetsPROMPT_COMMAND="starship_precmd".vte-2.91.shruns after it and, withVTE_VERSIONpresent, appends toPROMPT_COMMANDwhen it is a bash array and overwrites it otherwise. Starship leaves it a plain string, so the overwrite wins.~/.profilethen sources~/.bashrc, which sets a static PS1 and the user's aliases.The aliases land and the prompt does not, which is exactly what was reported. It is bash-only because that assignment is vte.sh's bash branch and neither fish nor pwsh reads
/etc/profile, and it needs a system-wide starship, because starship initialised from~/.bashrcruns after profile.d and wins. Confirmed against the reporter's own/etc/profile.d/vte-2.91.shand theirdiffof the two environments, not a reconstruction.The change
drop_session_scoped_envremoves session-scoped variables from theCommandBuilderimmediately before spawn, which is late enough to also cover the env map the frontend re-applies.The list separates two things:
VTE_VERSIONis the confirmed cause of Terminal: Starship.rs custom prompt not set in Bash when SideX started from CLI #112. It is also wrong to forward on its own terms: this terminal renders through xterm.js, not VTE, so advertising a VTE version additionally makes bash emit VTE title sequences at every prompt.PS0-PS4,PROMPT_COMMAND,RPROMPT, starship's runtime variables,SHLVL,OLDPWD,_,BASH_ENV,ENV, exported bash functions, and the VS Code shell-integration markers. The bash-preexec and ble.sh detection names are the notable ones: if__bp_imported,bash_preexec_imported,precmd_functionsorpreexec_functionsis present without bash-preexec actually being loaded, starship's init takes its bash-preexec branch and registers into arrays nothing ever runs, so the prompt is never drawn while the rest of.bashrcstill applies. Reproduced by presetting any one of them.Configuration the user opted into is deliberately kept:
STARSHIP_CONFIG,STARSHIP_CACHE,PATH,HOME,SHELL,TERM. Stripping those would break the prompt from the other direction.A menu launch has none of these variables, so the filter is a no-op there and both launch paths now hand the shell the same clean slate.
Verification
CommandBuilder:cargo test --lib commands::terminalpasses, 3 passed / 0 failed.cargo fmt --checkreports no diff for this file.cargo clippy --no-deps --all-targets -- -D warningsproduces no diagnostics for this file.Note for reviewers: the clippy gate is currently failing repo-wide for unrelated reasons on clippy 0.1.98 (274 findings in
sidex, one insidex-text), which looks like toolchain drift given there is norust-toolchain.tomlpin. Worth a separate pass.