JanDeDobbeleer / oh-my-posh2

A prompt theming engine for Powershell
MIT License
5.19k stars 284 forks source link

How can I hide user name? #290

Closed rediffusion closed 4 years ago

rediffusion commented 4 years ago

How can I hide this?

image

JanDeDobbeleer commented 4 years ago

Not yet ATM, unless you create a new theme. You can find out about that here. I'm about to create an alpha of V2 that has the ability to display whatever you want and don't want so check back in a little month :-)

rediffusion commented 4 years ago

@JanDeDobbeleer

I'm just going here:

C:\Users\HOME-PC\Documents\WindowsPowerShell\Modules\oh-my-posh\2.0.449\Themes\

...then in file "Paradox" comment some lines, now it looks like this:

    # $user = $sl.CurrentUser
    # $computer = $sl.CurrentHostname
    $path = Get-FullPath -dir $pwd
    # if (Test-NotDefaultUser($user)) {
    #     $prompt += Write-Prompt -Object "$user@$computer " -ForegroundColor $sl.Colors.SessionInfoForegroundColor -BackgroundColor $sl.Colors.SessionInfoBackgroundColor
    # }

Can get where is this symbol?

image

I want it for the right prompt...

JanDeDobbeleer commented 4 years ago

That symbol is the Administrator symbol. Top of my head, there should be a Test-Administrator function which will print that one if so.

rediffusion commented 4 years ago

@JanDeDobbeleer

Exactly❗

Now my file looks like 🔗 this:

I made change:

$prompt += Set-CursorForRightBlockWrite -textLength ($timestamp.Length + 1)

...to

$prompt += Set-CursorForRightBlockWrite -textLength ($timestamp.Length + 2)

Now, attention! I put after, this code:

#check for elevated prompt
If (Test-Administrator) {
    $prompt += Write-Prompt -Object "$($sl.PromptSymbols.ElevatedSymbol) " -ForegroundColor $sl.Colors.AdminIconForegroundColor -BackgroundColor $sl.Colors.SessionInfoBackgroundColor
}

Works like a charm. Cheers! 👍⭐