Created
June 5, 2020 20:57
-
-
Save ninmonkey/2a7d3440deec30aaa4e65e38866745d7 to your computer and use it in GitHub Desktop.
dymamic prompt: switches between the VS Code addon profile, and windows terminal
This file contains 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
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