JanDeDobbeleer / oh-my-posh

The most customisable and low-latency cross platform/shell prompt renderer
https://ohmyposh.dev
MIT License
16.79k stars 2.35k forks source link

Unable to change theme since v3.75.1 #355

Closed LarsBauer closed 3 years ago

LarsBauer commented 3 years ago

Prerequisites

Description

After upgrading to the latest version of the PowerShell module I noticed that the theme was reset to the default one. I tried to change it but the command Set-PoshPrompt -Theme sorin does not work. So I started downgrading and with v3.75.0 it started working again.

This is my PowerShell profile:

Import-Module oh-my-posh
Set-PoshPrompt -Theme sorin

Environment

Steps to Reproduce

  1. Install v3.75.1
  2. Import module and try to change change theme

Expected behavior: The prompt should change to the selected theme.

Actual behavior: The prompt does not change.

JanDeDobbeleer commented 3 years ago

It works for me without the -Theme switch, can you tab through it and validate the autocomplete and setting of the prompt?

LarsBauer commented 3 years ago

Thanks for the quick reply. I upgraded to the latest version and tried without the -Theme switch. Unfortunately this does not work either.

image

Edit: Autocomplete for the themes works fine.

JanDeDobbeleer commented 3 years ago

@LarsBauer allow me to validate this in the evening. I did check that so maybe there's something else that influences this negatively. It sets a config, but as the text states, it can't open that location somehow.

JanDeDobbeleer commented 3 years ago

@LarsBauer confirmed to work on my machine, so some follow-up questions. Do you have a space in a folder somewhere? Or a mounted drive/Onedrive integration?

LarsBauer commented 3 years ago

Yes, OneDrive integration is enabled so I guess there could be some spaces in the path. Can't check for sure because I am not on my work computer right now.

JanDeDobbeleer commented 3 years ago

That's probably it though, will try to reproduce 😅

JanDeDobbeleer commented 3 years ago

@LarsBauer found the issue. Fix incoming.

LarsBauer commented 3 years ago

Just upgraded and the issue is gone. 👍 Thank you a lot for the quick fix and your dedication to this awesome tool.

danvim commented 3 years ago

Thanks for the quick reply. I upgraded to the latest version and tried without the -Theme switch. Unfortunately this does not work either.

image

Edit: Autocomplete for the themes works fine.

Do you know what was causing the problem? I also find it weird it says UNABLE TO OPEN CONFIG. I'm getting this with version 3.129.0

JanDeDobbeleer commented 3 years ago

Can you show me your invocation?

danvim commented 3 years ago

Can you show me your invocation?

Same as OP,

Import-Module oh-my-posh
Set-PoshPrompt -Theme agnoster
# or
Set-PoshPrompt agnoster

But I must say, the computer I'm using is pretty locked down for security reasons. I've tested the same in my own personal PC and it works fine with the same version. One of the reasons I wanted oh-my-posh was the git display. I'm currently settling with using posh-git directly.

JanDeDobbeleer commented 3 years ago

@danvim I have no idea why it can't open the file, in theory you should be able to get the agnoster config, store it somewhere your user has access to and point to that file when setting the prompt.

Import-Module oh-my-posh
Set-PoshPrompt -Theme ~/agnoster.omp.json
danvim commented 3 years ago

@danvim I have no idea why it can't open the file, in theory you should be able to get the agnoster config, store it somewhere your user has access to and point to that file when setting the prompt.

Import-Module oh-my-posh
Set-PoshPrompt -Theme ~/agnoster.omp.json

I am able to copy the file to C: and set the theme now. Thanks.

On the other note, ~/Documents, where Powershell's modules get installed on this PC is on a network drive, with the path containing a $. I'm not sure if that's a problem.

JanDeDobbeleer commented 3 years ago

@danvim That's a problem in Powershell yes

rolflobker commented 3 years ago

Installed in pwsh 7 (core) under Debian Set-PoshTheme works fine

Set-PoshTheme ys Export-PoshTheme -FilePath ~/.oh-my-posh.omp.json Set-PoshPrompt -Theme ~/.oh-my-posh.omp.json

UNABLE TO OPEN CONFIG

Set-PoshTheme jandedobbeleer Export-PoshTheme -FilePath ~/.oh-my-posh.omp.json Set-PoshPrompt -Theme ~/.oh-my-posh.omp.json

Works just fine

Also works with theme Slim Have not tested others

So at least with export of theme 'ys' we get a ' UNABLE TO OPEN CONFIG'

JanDeDobbeleer commented 3 years ago

Allow me to check that.

rolflobker commented 3 years ago

Allow me to check that.

I will allow that.

JanDeDobbeleer commented 3 years ago

@rolflobker someone added a \b in there which is a backspace character and fails to get parsed properly after export. I removed them we'll see what breaks when an issue pops up ;-)

github-actions[bot] commented 5 months ago

This issue has been automatically locked since there has not been any recent activity (i.e. last half year) after it was closed. It helps our maintainers focus on the active issues. If you have found a problem that seems similar, please open a discussion first, complete the body with all the details necessary to reproduce, and mention this issue as reference.