feat(fastfetch): date the updates line and quieten pwsh startup - #654
Merged
Conversation
Three papercuts from #645, reported after using it for a day. The Updates line never said how old its numbers were, so "6 updates available" could equally be from a minute or an hour ago. Unix already had a token renderer for exactly this (relative times are stored as absolute epochs and expanded at emit, so they never freeze in the cache); generalize it so tokens expand to a bare duration and the collectors own the wording, then add "checked 5m ago" to the updates line on both platforms. Windows cannot expand at emit time -- fastfetch reads the cache with `cmd /c type` -- so each section is now stored twice: <name>.src keeps the token and <name> is the rendered copy, re-rendered on every shell start just before fastfetch runs. That render lives in DotfilesHelpers because the profile already imports it, where dot-sourcing status.ps1 would add ~60ms to profile load. profile.ps1 loses 45 lines as a result. Opening a shell also printed four lines that fastfetch already covers: PowerShell 7.6.4 [OK] PowerShell Profile Loaded (1364 ms) >> Type 'aliases' to see available aliases Loading personal and system profiles took 1513ms. The first and last are printed by pwsh itself around profile load, so they cannot be suppressed from profile.ps1; add Set-WindowsTerminalProfileCommandLine and a run_onchange script that launches the Windows Terminal profile as `pwsh.exe -NoLogo -NoProfileLoadTime`. The middle two are ours and are now skipped when the fastfetch banner rendered -- a light install without fastfetch keeps them, so an interactive shell still confirms the profile loaded. Co-authored-by: Copilot App <223556219+Copilot@users.noreply.github.com> Copilot-Session: 6ff40b19-afbf-48c8-9b80-233b13652222
This was referenced Jul 30, 2026
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.
Three papercuts from #645, found after living with it for a day.
1. The Updates line now says how old it is
Updates: 📦 6 update(s) available (winget) · checked 5m agoPreviously "6 updates available" could equally be from a minute or an hour ago.
The Unix script already had machinery for exactly this problem: relative times are stored as absolute epoch tokens and expanded at emit, so they never freeze at whatever they were when the cache was written. This generalises it so a token expands to a bare duration (
@ago:→5m ago) and the collectors own the wording around it (ran @ago:@,next @in:@,checked @ago:@). Same rendered output as before for the ansible line, and one less token kind to invent next time.Windows can't expand at emit time — fastfetch reads the cache with
cmd /c type. So each section is now stored twice:<name>.srckeeps the token,<name>is the rendered copy, and the tokens are expanded on every shell start just before fastfetch runs. A pre-renderedchecked 0s agowould otherwise sit there lying for an hour until the next refresh.Why the render lives in
DotfilesHelpersrather thanstatus.ps1: it has to run on every shell start, and dot-sourcingstatus.ps1from the profile measured ~60ms (signature block included). The profile already imports the module, so putting it there is free.status.ps1imports the module after a refresh so a manualstatus.ps1 refreshalso leaves a correctly rendered cache. Side benefit:profile.ps1gives back the 45-line spawn block it gained in #645.2/3. A quiet PowerShell startup
Opening a shell printed four lines that fastfetch already covers:
profile.ps1. The only lever is the command line the terminal starts, hence a newSet-WindowsTerminalProfileCommandLine+ run_onchange script that setspwsh.exe -NoLogo -NoProfileLoadTimeon the PowerShell Core profile. Only that one key is touched, so hand-tuned configs survive.pwsh.exeis left to PATH resolution rather than pinned, so it survives PowerShell upgrades.Changes
executable_status.sh— generalised token renderer,checkedsuffix on the updates linestatus.ps1— writesupdates.src(tokenised) and delegates renderingDotfilesHelpers/Public/FastfetchStatus.ps1(new) —Update-FastfetchStatusCache, token expansion, duration formatting, detached refreshWindowsTerminal.ps1—Set-WindowsTerminalProfileCommandLinerun_onchange_set-windows-terminal-powershell-args.ps1.tmpl(new)profile.ps1— one call instead of the inline block; welcome lines conditionalTesting
main(baseline: 717/10).chezmoi apply --dry-runclean;chezmoi managedconfirms the new module file and per-OS status scripts ship correctly.Verified live end to end:
checked 0s ago; back-dating the source and re-rendering (no refresh) giveschecked 1h ago, proving the age tracks the clock rather than the cache.[OK] Profile Loaded.Set-WindowsTerminalProfileCommandLineexercised for Updated / AlreadySet / ProfileNotFound / WhatIf against a realisticsettings.json.Note
One commit-time wrinkle worth flagging: the
file-set-execution-bitlefthook hook can't launch from Windows (sh: cannot execute: required file not found), so I excluded it for the commit and ran it manually under WSL instead — it passes, and the file is already staged as100755. Unrelated to this change, but it will bite on any Windows commit that touches a.shfile.