Skip to content

Commit 528c4c3

Browse files
committed
💄 Add emoji indicators for non-powerline rendering
1 parent 6c78a97 commit 528c4c3

File tree

2 files changed

+57
-12
lines changed

2 files changed

+57
-12
lines changed

‎Show-Status.ps1‎

Lines changed: 44 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -50,6 +50,38 @@ Begin
5050
WAIT = 'HOURGLASS WITH FLOWING SAND'
5151
'UP!' = 'SQUARED UP WITH EXCLAMATION MARK'
5252
} -AsEmoji
53+
if(Test-WindowsTerminal.ps1)
54+
{
55+
Set-Variable -Name LEFTEND -Value (Get-Unicode.ps1 0xE0B6) -Scope Script -Option Constant -EA Ignore `
56+
-Description 'nf-ple-left_half_circle_thick (wt)'
57+
Set-Variable -Name RIGHTEND -Value (Get-Unicode.ps1 0xE0B4) -Scope Script -Option Constant -EA Ignore `
58+
-Description 'nf-ple-right_half_circle_thick (wt)'
59+
Set-Variable -Name DOTNET -Value (Get-Unicode.ps1 0xE77F) -Scope Script -Option Constant -EA Ignore `
60+
-Description 'nf-dev-dotnet (wt)'
61+
Set-Variable -Name GIT -Value (Get-Unicode.ps1 0xF1D2) -Scope Script -Option Constant -EA Ignore `
62+
-Description 'nf-fa-git_square (wt)'
63+
Set-Variable -Name WINDOWS -Value (Get-Unicode.ps1 0xF17A) -Scope Script -Option Constant -EA Ignore `
64+
-Description 'nf-fa-windows (wt)'
65+
Set-Variable -Name LINUX -Value (Get-Unicode.ps1 0xF17C) -Scope Script -Option Constant -EA Ignore `
66+
-Description 'nf-fa-linux (wt)'
67+
Set-Variable -Name MAC -Value (Get-Unicode.ps1 0xF179) -Scope Script -Option Constant -EA Ignore `
68+
-Description 'nf-fa-apple (wt)'
69+
Set-Variable -Name POWERSHELL -Value (Get-Unicode.ps1 0xE86C) -Scope Script -Option Constant -EA Ignore `
70+
-Description 'nf-dev-powershell (wt)'
71+
}
72+
else
73+
{
74+
Import-CharConstants.ps1 -Alias @{
75+
LEFTEND = 'BLACK MEDIUM LEFT-POINTING TRIANGLE'
76+
RIGHTEND = 'BLACK MEDIUM RIGHT-POINTING TRIANGLE'
77+
DOTNET = 'SINE WAVE'
78+
GIT = 'CIRCLED LATIN SMALL LETTER G'
79+
WINDOWS = 'WINDOW'
80+
LINUX = 'PENGUIN'
81+
MAC = 'RED APPLE'
82+
POWERSHELL = 'SUPERHERO'
83+
} -AsEmoji
84+
}
5385

5486
function Get-WinGetTest
5587
{
@@ -99,7 +131,7 @@ Begin
99131
{
100132
AdminIndicator { (Test-Administrator.ps1) ? $REDCIRCLE : $BLUECIRCLE }
101133
ComputerName {"$COMPUTER $([Environment]::MachineName)"}
102-
DotNetVersion {"$([char]0xE77F) .NET $([Environment]::Version)"}
134+
DotNetVersion {"$DOTNET .NET $([Environment]::Version)"}
103135
DriveUsage
104136
{
105137
$HARDDISK + ' ' + ((Get-PSDrive -PSProvider FileSystem |Where-Object {$null -ne $_.Free} |
@@ -115,17 +147,17 @@ Begin
115147
"$OVERLAP $euser"
116148
}
117149
GitUser {(git config user.name) ?
118-
"$([char]0xF1D2) $(git config user.name) <$(git config user.email)>" :
119-
"$([char]0xF1D2) $REDX"}
150+
"$GIT $(git config user.name) <$(git config user.email)>" :
151+
"$GIT $REDX"}
120152
HomeDirectory {"$HOUSE $HOME"}
121153
OSVersion
122154
{
123-
if($IsWindows) {"$([char]0xF17A) $([Environment]::OSVersion.VersionString)"}
124-
elseif($IsLinux) {"$([char]0xF17C) $([Environment]::OSVersion.VersionString) $($PSVersionTable.OS)"}
125-
elseif($IsMacOS) {"$([char]0xF179) $([Environment]::OSVersion.VersionString) $($PSVersionTable.OS)"}
155+
if($IsWindows) {"$WINDOWS $([Environment]::OSVersion.VersionString)"}
156+
elseif($IsLinux) {"$LINUX $([Environment]::OSVersion.VersionString) $($PSVersionTable.OS)"}
157+
elseif($IsMacOS) {"$MAC $([Environment]::OSVersion.VersionString) $($PSVersionTable.OS)"}
126158
}
127-
PowerShellCommand {"$([char]0xE86C) $([Environment]::ProcessPath) $([Environment]::CommandLine)"}
128-
PowerShellVersion {"$([char]0xE86C) PS $($PSVersionTable.PSVersion) $($PSVersionTable.PSEdition)"}
159+
PowerShellCommand {"$POWERSHELL $([Environment]::ProcessPath) $([Environment]::CommandLine)"}
160+
PowerShellVersion {"$POWERSHELL PS $($PSVersionTable.PSVersion) $($PSVersionTable.PSEdition)"}
129161
Updates
130162
{
131163
$updates = @(
@@ -144,12 +176,12 @@ Begin
144176
}
145177
Process
146178
{
147-
Write-Info.ps1 (Get-Unicode.ps1 0xE0B6) -ForegroundColor $BackgroundColor -NoNewline
179+
Write-Info.ps1 $LEFTEND -ForegroundColor $BackgroundColor -NoNewLine
148180
Write-Info.ps1 " $WAIT " -ForegroundColor $ForegroundColor -BackgroundColor $BackgroundColor -NoNewline
149-
Write-Info.ps1 (Get-Unicode.ps1 0xE0B4) -fore $BackgroundColor -NoNewLine
150-
Write-Info.ps1 "`b`b`b`b" -NoNewline
181+
Write-Info.ps1 $RIGHTEND -ForegroundColor $BackgroundColor -NoNewLine
182+
Write-Info.ps1 (New-Object string "`b",($RIGHTEND.Length+2)) -NoNewline
151183
Write-Info.ps1 (($Status |Format-Status) -join $Separator) `
152184
-ForegroundColor $ForegroundColor -BackgroundColor $BackgroundColor -NoNewline
153185
Write-Info.ps1 ' ' -ForegroundColor $ForegroundColor -BackgroundColor $BackgroundColor -NoNewline
154-
Write-Info.ps1 (Get-Unicode.ps1 0xE0B4) -fore $BackgroundColor
186+
Write-Info.ps1 $RIGHTEND -ForegroundColor $BackgroundColor
155187
}

‎Test-WindowsTerminal.ps1‎

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,13 @@
1+
<#
2+
.SYNOPSIS
3+
Returns true if PowerShell is running within Windows Terminal.
4+
#>
5+
6+
#Requires -Version 7
7+
[CmdletBinding()] Param()
8+
if(!$IsWindows) {return $false}
9+
for($process = Get-Process -Id $PID; $process; $process = $process.Parent)
10+
{
11+
if($process.ProcessName -eq 'WindowsTerminal') {return $true}
12+
}
13+
return $false

0 commit comments

Comments
 (0)