Skip to content

Commit

Permalink
Added ability to get Posh Git to write the current repository and bra…
Browse files Browse the repository at this point in the history
…nch to the window title
  • Loading branch information
AButler committed Mar 22, 2013
1 parent 89f1ebf commit 9232f70
Showing 1 changed file with 12 additions and 0 deletions.
12 changes: 12 additions & 0 deletions GitPrompt.ps1
Original file line number Diff line number Diff line change
Expand Up @@ -46,6 +46,8 @@ $global:GitPromptSettings = New-Object PSObject -Property @{
EnableFileStatus = $true
RepositoriesInWhichToDisableFileStatus = @( ) # Array of repository paths

EnableWindowTitle = $true

Debug = $false
}

Expand Down Expand Up @@ -123,6 +125,16 @@ function Write-GitStatus($status) {
}

Write-Prompt $s.AfterText -BackgroundColor $s.AfterBackgroundColor -ForegroundColor $s.AfterForegroundColor

if ($s.EnableWindowTitle) {
if( -not $Global:PreviousWindowTitle ) {
$Global:PreviousWindowTitle = $Host.UI.RawUI.WindowTitle
}
$repoName = Split-Path -Leaf (Split-Path $status.GitDir)
$Host.UI.RawUI.WindowTitle = "posh-git - $repoName [$($status.Branch)]"
}
} elseif ( $Global:PreviousWindowTitle ) {
$Host.UI.RawUI.WindowTitle = $Global:PreviousWindowTitle
}
}

Expand Down

0 comments on commit 9232f70

Please sign in to comment.