Skip to content

Instantly share code, notes, and snippets.

@jimbrig
Forked from mdgrs-mei/TerminalSpinner.ps1
Created June 28, 2023 21:37
Show Gist options
  • Save jimbrig/748b08d9ed84aae58e95bbaa6dc93af1 to your computer and use it in GitHub Desktop.
Save jimbrig/748b08d9ed84aae58e95bbaa6dc93af1 to your computer and use it in GitHub Desktop.
Show spinner on the Windows Terminal tabs for every command.
$global:originalPSConsoleHostReadLine = $function:global:PSConsoleHostReadLine
$global:originalPrompt = $function:global:Prompt
$function:global:PSConsoleHostReadLine = {
$startProgressIndicator = "`e]9;4;3;50`e\"
$command = $originalPSConsoleHostReadLine.Invoke()
$startProgressIndicator | Write-Host -NoNewLine
$command
}
$function:global:Prompt = {
$stopProgressIndicator = "`e]9;4;0;50`e\"
$stopProgressIndicator | Write-Host -NoNewLine
$originalPrompt.Invoke()
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment