Repository navigation
fix(zsh): start the window manager above the p10k instant prompt - #211
Open
ipproyectosysoluciones wants to merge 1 commit into
Open
ipproyectosysoluciones wants to merge 1 commit into
ipproyectosysoluciones wants to merge 1 commit into
Conversation
The WM launcher (`start_if_needed`) sat below powerlevel10k's instant-prompt block. That block runs the rest of the file in a subshell with stdout redirected, where `[[ -t 1 ]]` is false and an `exec` would only replace the subshell -- so the window manager (tmux, zellij or herdr) never started and the terminal was left with a plain shell. The p10k comment directly above the block already states that code needing a real terminal must go above it. The launcher definition and its call now live at the top of the template, ahead of the instant prompt, with a comment explaining the constraint. Tests added (`installer/internal/system/zsh_template_test.go`): one asserts the template keeps the launcher above the instant prompt, the other patches the real template for each WM and asserts `PatchZshForWM` preserves that order.
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.
What
Moves the window-manager launcher (
start_if_needed) and its call to the top of the Zsh template, above the powerlevel10k instant-prompt block.Closes #210.
Why
The instant prompt runs the rest of
.zshrcin a subshell with stdout redirected, where[[ -t 1 ]]is false (the guard bails out) and anexecwould only replace that subshell — so the WM (tmux,zellijorherdr) never autostarted and the terminal was left with a plain shell. Measurements and the reproduction are in #210.Changes
GentlemanZsh/.zshrc: launcher definition + call moved above the instant prompt, with a comment explaining the constraint so it does not get moved back.installer/internal/system/zsh_template_test.go(new):TestZshTemplateLaunchesWMBeforeP10kInstantPrompt— the template keeps the launcher above the instant prompt (skips if p10k is ever dropped).TestPatchZshForWMKeepsLauncherAboveInstantPrompt— patches the real template fortmux/zellij/herdrand assertsPatchZshForWMpreserves the order and still selects the chosen WM.Verification
zsh -n GentlemanZsh/.zshrc→ syntax valid.go test ./internal/system/ ./internal/tui/trainer/ ./cmd/...→ pass.Not in this PR
The TUI golden tests (
TestWelcomeScreenGolden,TestMainMenuGolden,TestOSSelectGolden) fail on Linux because they expect a macOS-detected frame. Pre-existing onmain, unrelated to this fix — happy to send a separate PR if useful.Note for existing installs
An already-installed
~/.zshrckeeps the old order until the template is copied again (re-running the installer). Related: #206, about preserving local Zsh customizations across updates.