oh-my-posh: Oh My Posh not setting theme on windows terminal

Code of Conduct

  • I agree to follow this project’s Code of Conduct

What happened?

Oh My Posh suddenly stopped working on Powershell in the Windows Terminal App (and in other places). Here is how the powershell looks now image

Theme

I use the blue-owl theme normally which isn’t working. I tried other themes and none of them are working. I set the theme using this line in my $profile oh-my-posh --init --shell pwsh --config "~/AppData/Local/Programs/oh-my-posh/themes/blue-owl.omp.json" | Invoke-Expression

Write-PoshDebug (PowerShell) is just returning Loading personal and system profiles took 803ms. and nothing else. I’m posting the result of Write-PoshDebug below

What OS are you seeing the problem on?

Windows

Which shell are you using?

powershell

Log output

Version: 7.18.0

Segments:

ConsoleTitle(false) -   0 ms -
session(true)  -   0 ms -  pansr@Sravan-Spectre 
path(true)     -   0 ms -  pansr
shell(true)    -   0 ms -  pwsh
text(true)     -   0 ms -  no config
exit(true)     -   1 ms -  

Run duration: 2.2573ms

Cache path: C:\Users\pansr\AppData\Local/oh-my-posh

Logs:

2022/02/17 18:56:33 Args duration: 0s, args:
2022/02/17 18:56:33 Args duration: 0s, args:
2022/02/17 18:56:33 Args duration: 0s, args:
2022/02/17 18:56:33 Shell duration: 15.139ms, args:
2022/02/17 18:56:33 debug: Getenv

2022/02/17 18:56:33 Getenv duration: 0s, args: OMP_CACHE_DISABLED
2022/02/17 18:56:33 debug: Pwd
C:\Users\pansr
2022/02/17 18:56:33 Pwd duration: 0s, args:
2022/02/17 18:56:33 debug: Home
C:\SPB_Data
2022/02/17 18:56:33 PathSeperator duration: 0s, args:
2022/02/17 18:56:33 PathSeperator duration: 0s, args:
2022/02/17 18:56:33 PathSeperator duration: 0s, args:
2022/02/17 18:56:33 PathSeperator duration: 0s, args:
2022/02/17 18:56:33 PathSeperator duration: 0s, args:
2022/02/17 18:56:33 PathSeperator duration: 0s, args:
2022/02/17 18:56:33 PathSeperator duration: 0s, args:
2022/02/17 18:56:33 debug: Pwd
C:\Users\pansr
2022/02/17 18:56:33 Pwd duration: 0s, args:
2022/02/17 18:56:33 debug: Home
C:\SPB_Data
2022/02/17 18:56:33 debug: Getenv

2022/02/17 18:56:33 Getenv duration: 0s, args: SSH_CONNECTION
2022/02/17 18:56:33 debug: Getenv

2022/02/17 18:56:33 Getenv duration: 0s, args: SSH_CLIENT
2022/02/17 18:56:33 Root duration: 0s, args:
2022/02/17 18:56:33 Shell duration: 0s, args:
2022/02/17 18:56:33 ErrorCode duration: 0s, args:
2022/02/17 18:56:33 IsWsl duration: 0s, args:
2022/02/17 18:56:33 debug: Pwd
C:\Users\pansr
2022/02/17 18:56:33 Pwd duration: 0s, args:
2022/02/17 18:56:33 debug: Home
C:\SPB_Data
2022/02/17 18:56:33 PathSeperator duration: 0s, args:
2022/02/17 18:56:33 PathSeperator duration: 0s, args:
2022/02/17 18:56:33 PathSeperator duration: 0s, args:
2022/02/17 18:56:33 PathSeperator duration: 0s, args:
2022/02/17 18:56:33 PathSeperator duration: 0s, args:
2022/02/17 18:56:33 PathSeperator duration: 0s, args:
2022/02/17 18:56:33 PathSeperator duration: 0s, args:
2022/02/17 18:56:33 User duration: 0s, args:
2022/02/17 18:56:33 Host duration: 0s, args:
2022/02/17 18:56:33 GOOS duration: 0s, args:
2022/02/17 18:56:33 TemplateCache duration: 0s, args:
2022/02/17 18:56:33 debug: Pwd
C:\Users\pansr
2022/02/17 18:56:33 Pwd duration: 0s, args:
2022/02/17 18:56:33 debug: Home
C:\SPB_Data
2022/02/17 18:56:33 debug: Pwd
C:\Users\pansr
2022/02/17 18:56:33 Pwd duration: 0s, args:
2022/02/17 18:56:33 Args duration: 0s, args:
2022/02/17 18:56:33 debug: Home
C:\SPB_Data
2022/02/17 18:56:33 GOOS duration: 0s, args:
2022/02/17 18:56:33 GOOS duration: 0s, args:
2022/02/17 18:56:33 PathSeperator duration: 0s, args:
2022/02/17 18:56:33 PathSeperator duration: 0s, args:
2022/02/17 18:56:33 PathSeperator duration: 0s, args:
2022/02/17 18:56:33 PathSeperator duration: 0s, args:
2022/02/17 18:56:33 PathSeperator duration: 0s, args:
2022/02/17 18:56:33 PathSeperator duration: 0s, args:
2022/02/17 18:56:33 PathSeperator duration: 0s, args:
2022/02/17 18:56:33 PathSeperator duration: 0s, args:
2022/02/17 18:56:33 GOOS duration: 0s, args:
2022/02/17 18:56:33 IsWsl duration: 0s, args:
2022/02/17 18:56:33 StackCount duration: 0s, args:
2022/02/17 18:56:33 TemplateCache duration: 0s, args:
2022/02/17 18:56:33 debug: Pwd
C:\Users\pansr
2022/02/17 18:56:33 Pwd duration: 0s, args:
2022/02/17 18:56:33 debug: Home
C:\SPB_Data
2022/02/17 18:56:33 Shell duration: 0s, args:
2022/02/17 18:56:33 TemplateCache duration: 0s, args:
2022/02/17 18:56:33 debug: Pwd
C:\Users\pansr
2022/02/17 18:56:33 Pwd duration: 0s, args:
2022/02/17 18:56:33 debug: Home
C:\SPB_Data
2022/02/17 18:56:33 TemplateCache duration: 0s, args:
2022/02/17 18:56:33 debug: Pwd
C:\Users\pansr
2022/02/17 18:56:33 Pwd duration: 0s, args:
2022/02/17 18:56:33 debug: Home
C:\SPB_Data
2022/02/17 18:56:33 ErrorCode duration: 0s, args:
2022/02/17 18:56:33 TemplateCache duration: 0s, args:
2022/02/17 18:56:33 TemplateCache duration: 0s, args:
2022/02/17 18:56:33 TemplateCache duration: 0s, args:
2022/02/17 18:56:33 debug: Getenv
C:\Users\pansr\AppData\Local
2022/02/17 18:56:33 Getenv duration: 0s, args: LOCALAPPDATA
2022/02/17 18:56:33 CachePath duration: 0s, args:

About this issue

  • Original URL
  • State: closed
  • Created 2 years ago
  • Reactions: 2
  • Comments: 39 (17 by maintainers)

Most upvoted comments

I think I figured out what the issue is: I was setting the path to the config files earlier as "~/AppData/Local/Programs/oh-my-posh/themes/blue-owl.omp.json" Changing it to "C:/Users/pansr/AppData/Local/Programs/oh-my-posh/themes/blue-owl.omp.json" solved the issue. I think something changed in the code which refers to the home folder. So now the home folder is not showing the home icon image

For those who installed oh-my-posh with scoop, make sure your $PROFILE is using $(scoop prefix oh-my-posh)

oh-my-posh --init --shell pwsh --config "$(scoop prefix oh-my-posh)\themes\robbyrussel.omp.json" | Invoke-Expression

I solved adding the following command in my $PROFILE oh-my-posh --init --shell pwsh --config "~/AppData/Local/Programs/oh-my-posh/themes/the-unnamed.omp.json" | Invoke-Expression

@JanDeDobbeleer It is working with the latest version 7.29.0. Also I think some program changed my home path as I referred before:

$env:HOME
C:\SPB_Data

Changing it back to

$env:HOME
C:\Users\pansr

Solved the issue. You can close this issue. Thanks a lot for your help. I learnt a lot during this

@sravanpannala I tried to reproduce your issue and it’s simply impossible.

image

To resolve the HOME path we validate the following. Can you provide the output of these env vars?

  • $env:HOME
  • $env:HOMEPATH
  • $env:HOMEDRIVE
  • $env:USERPROFILE

i changed the $PROFILE value to oh-my-posh init pwsh --config 'C:\Users\user\AppData\Local\Programs\oh-my-posh\themes\robbyrussell.omp.json' | Invoke-Expression and it worked

@kennedy I’m looking to restructure the docs so these elements can be easily added. It’s a limitation of docusaurus that you can’t yet work with variables.