Skip to content

Instantly share code, notes, and snippets.

@ninmonkey
Created June 5, 2020 20:57
Show Gist options
  • Save ninmonkey/2a7d3440deec30aaa4e65e38866745d7 to your computer and use it in GitHub Desktop.
Save ninmonkey/2a7d3440deec30aaa4e65e38866745d7 to your computer and use it in GitHub Desktop.
dymamic prompt: switches between the VS Code addon profile, and windows terminal
function Prompt() {
$ProfileName = nin_guess_terminal
# ... switch
}
function nin_guess_terminal() {
<#
detect whether you're running from
vscode addon, windows terminal or other
#>
$parent_name = (Get-Process -Id $PID).Parent.ProcessName
if( $profile -like '*vscode*' -or $parent_name -like '*code*' ) {
return 'vscode'
} elseif ($parent_name -like '*windows*terminal*' ) {
return 'WindowsTerminal'
} else {
return 'terminal'
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment