JanDeDobbeleer / oh-my-posh

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

Not switching themes #867

Closed NicTanghe closed 3 years ago

NicTanghe commented 3 years ago

Prerequisites

Description

Not switching themes after setting diferent file in $profile

Environment

Steps to Reproduce

  1. change theme in profile oh-my-posh --init --shell pwsh --config ~/iterm2.omp.json | Invoke-Expression
  2. restart windows terminal
  3. [and so on...]

Expected behavior: [What you expected to happen] Themes changed Actual behavior: [What actually happened] Theme diden`t change

JanDeDobbeleer commented 3 years ago

@NicTanghe that logic hasn't really changed. What output do you get? Might also be useful to get your theme so I can debug quickly. Thanks!

NicTanghe commented 3 years ago

The output I get is the same theme with your name. I assume I'm just doing something wrong, but I'm not 100% sure that is the case.

Here is my theme.

{
  "$schema": "https://raw.githubusercontent.com/JanDeDobbeleer/oh-my-posh/main/themes/schema.json",
  "final_space": true,
  "console_title": true,
  "console_title_style": "template",
  "console_title_template": "{{ .Shell }} in {{ .Folder }}",
  "blocks": [
    {
      "type": "prompt",
      "alignment": "left",
      "vertical_offset": 1,
      "segments": [
        {
          "type": "os",
          "style": "powerline",
          "powerline_symbol": "\uE0B0",
          "foreground": "#fff",
          "background": "#003543",
          "properties": {
            "prefix": " ",
            "windows": "\uF179",
            "postfix": ""
          }
        },
        {
          "type": "session",
          "style": "powerline",
          "powerline_symbol": "\uE0B0",
          "foreground": "#d2ff5e",
          "background": "#003543",
          "properties": {
            "prefix": "",
            "display_host": false,
            "postfix": " "
          }
        },
        {
          "type": "path",
          "style": "powerline",
          "powerline_symbol": "\uE0B0",
          "foreground": "#003544",
          "background": "#0087D8",
          "properties": {
            "prefix": " \uE5FF ",
            "style": "full",
            "folder_separator_icon": "/"
          }
        },
        {
          "type": "git",
          "style": "powerline",
          "powerline_symbol": "",
          "foreground": "#193549",
          "background": "#d2ff5e",
          "properties": {
            "display_stash_count": true,
            "display_upstream_icon": true,
            "status_colors_enabled": true,
            "display_status": true,
            "local_changes_color": "#ff9248",
            "ahead_and_behind_color": "#f26d50",
            "behind_color": "#f17c37",
            "ahead_color": "#89d1dc",
            "stash_count_icon": "\uF692 "
          }
        },
        {
          "type": "exit",
          "style": "powerline",
          "powerline_symbol": "\uE0B0",
          "foreground": "#242424",
          "background": "#33DD2D",
          "properties": {
            "display_exit_code": false,
            "always_enabled": true,
            "color_background": true,
            "error_color": "#f1184c",
            "prefix": " \ufc8d"
          }
        }
      ]
    },
    {
      "type": "prompt",
      "alignment": "right",
      "segments": [
        {
          "type": "battery",
          "style": "powerline",
          "invert_powerline": true,
          "powerline_symbol": "\uE0B2",
          "foreground": "#242424",
          "background": "#f36943",
          "properties": {
            "battery_icon": "\f583",
            "color_background": true,
            "charged_color": "#0476d0",
            "charging_color": "#33DD2D",
            "discharging_color": "#FFCD58",
            "postfix": "\uF295 \uf583 "
          }
        },
        {
          "type": "python",
          "style": "powerline",
          "invert_powerline": true,
          "powerline_symbol": "\uE0B2",
          "foreground": "#003544",
          "background": "#0087D8",
          "properties": {
            "prefix": " \uE235 ",
            "display_version": false,
            "display_mode": "context",
            "display_virtual_env": true
          }
        },
        {
          "type": "time",
          "style": "powerline",
          "invert_powerline": true,
          "powerline_symbol": "\uE0B2",
          "foreground": "#fff",
          "background": "#003543",
          "properties": {
            "prefix": "<#fff> \uf64f </>"
          }
        }
      ]
    },
    {
      "type": "prompt",
      "alignment": "left",
      "newline": true,
      "segments": [
        {
          "type": "root",
          "style": "plain",
          "foreground": "#FFD700",
          "properties": {
            "root_icon": "⚡"
          }
        },
        {
          "type": "text",
          "style": "plain",
          "foreground": "#f1184c",
          "properties": {
            "prefix": "",
            "text": "🚀"
          }
        }
      ]
    }
  ]
}
JanDeDobbeleer commented 3 years ago

@NicTanghe the theme works, so that's not it. What happens when you run the command directly in powershell? It could be you've set the wrong $PROFILE, just typing $PROFILE in powershell will display it's location.

NicTanghe commented 3 years ago

I edit my code with code $profile and all my costum functions work. the $profile of ps 5 is just a hardlink to the ps7 one. Maybe the theme is in the wrong location ? its stil in "~\AppData\Local\Programs\oh-my-posh\themes\"

JanDeDobbeleer commented 3 years ago

@NicTanghe if the theme is in that folder you need to use oh-my-posh --init --shell pwsh --config ~\AppData\Local\Programs\oh-my-posh\themes\iterm2.omp.json | Invoke-Expression otherwise indeed, that theme can't be found.

JanDeDobbeleer commented 3 years ago

@NicTanghe were you able to resolve the issue?

stale[bot] commented 3 years ago

This issue has been automatically marked as stale because it has not had recent activity. It will be closed in 7 days if no further activity occurs. Thank you for your contributions.

paulterinho commented 2 years ago

This is also happening with my fresh Bootcamp (dual booting on a mac) install on a Windows 10. The fix was that I had to create an absolute path instead of a relative one and it worked fine afterwards. (The tilda ~ wasn't working in the oh-my-posh --init --shell pwsh --config ~/aliens.omp.json | Invoke-Expression command)

JanDeDobbeleer commented 2 years ago

That's weird. Is this Powershell 5 or Core?

paulterinho commented 2 years ago

Powershell 5 (Cool theme by the way!)

JanDeDobbeleer commented 2 years ago

@paulito-bandito 6.42.1 should fix this.

paulterinho commented 2 years ago

Great!

On Thu, Dec 30, 2021 at 08:09 Jan De Dobbeleer @.***> wrote:

@paulito-bandito https://github.com/paulito-bandito 6.42.1 should fix this.

— Reply to this email directly, view it on GitHub https://github.com/JanDeDobbeleer/oh-my-posh/issues/867#issuecomment-1003069249, or unsubscribe https://github.com/notifications/unsubscribe-auth/ABLE2AGLANCF77KKKSM54H3UTRY3HANCNFSM5A4GAKHA . Triage notifications on the go with GitHub Mobile for iOS https://apps.apple.com/app/apple-store/id1477376905?ct=notification-email&mt=8&pt=524675 or Android https://play.google.com/store/apps/details?id=com.github.android&referrer=utm_campaign%3Dnotification-email%26utm_medium%3Demail%26utm_source%3Dgithub.

You are receiving this because you were mentioned.Message ID: @.***>

wavesinaroom commented 1 year ago

Hi @JanDeDobbeleer! Thanks for developing oh-my-posh, I now feel much more comfortable working on windows terminal than my previous complicated experience with i3 desktop environment. Setting it in my desktop computer wasn't hard at all. However, when reproducing the same steps on my laptop, changing themes always throws a config error.

I'm able to install oh-my-posh without any issue and set the default theme but I can't change themes.

Environment

OS: Windows 10 /Wsl2 Ubuntu Shell: Bash Terminal: Windows terminal Oh-my-posh installation: Linux manual

Steps to reproduce

  1. Install omp following linux manual guide
  2. Font couldn't be set up from omp cli but I had to download it from the recommended site and install it on windows before configuring it from windows terminal UI (Hack NF).
  3. eval "$(oh-my-posh init bash)" and exec bash launches omp default theme successfully albeit eval "$(oh-my-posh init bash --config ~/lambdageneration.omp.json)" throws CONFIG ERROR in the terminal. I've triple-checked typos and tried another theme just in case -> nothing.

I'm not sure what I might be doing wrong cause my desktop has pretty similar settings (Wsl, Ubuntu, Windows terminal) but my laptop doesn't have the theme set.

Would you like me to expand this issue with further useful info?

Cheers!

JanDeDobbeleer commented 1 year ago

@wavesinaroom if you use oh-my-posh debug --config ~/lambdageneration.omp.json it should show you exactly what's wrong. If you paste the output here, I can also have a look.

wavesinaroom commented 1 year ago

Sure! Thanks a lot! What does [DEBUG] 16:40:39.575 shell.go:Getenv:375 → NO DATA mean? I saw omp couldn't find the themes folder, is that a clue?

`Version: 14.7.1

Segments:

ConsoleTitle(true) - 0 ms - bash in wavesinaroom session(true) - 0 ms -  wavesinaroom  path(true) - 3 ms -   ~ git(false) - 2 ms - root(false) - 0 ms - exit(true) - 0 ms -  CONFIG ERROR  node(false) - 0 ms - go(false) - 0 ms - python(false) - 0 ms - shell(true) - 0 ms - in bash time(true) - 0 ms - at 16:40:39

Run duration: 7.9859ms

Cache path: /home/wavesinaroom

Config path: /home/wavesinaroom/lambdageneration.omp.json

Logs:

[DEBUG] 16:40:39.575 shell.go:Getenv:375 → NO DATA [TRACE] 16:40:39.575 shell.go:Getenv(XDG_CACHE_HOME) - 35.3µs [TRACE] 16:40:39.575 shell_unix.go:CachePath() - 60.3µs [DEBUG] 16:40:39.575 shell_unix.go:Platform:63 → ubuntu [TRACE] 16:40:39.575 shell.go:resolveConfigPath() - 14.1µs [TRACE] 16:40:39.575 shell.go:Init() - 241.1µs [TRACE] 16:40:39.575 shell.go:Flags() - 0s [ERROR] 16:40:39.575 config.go:loadConfig:130 → open /home/wavesinaroom/lambdageneration.omp.json: no such file or directory [TRACE] 16:40:39.575 config.go:loadConfig() - 35.4µs [TRACE] 16:40:39.575 shell.go:Flags() - 100ns [DEBUG] 16:40:39.575 shell.go:Getenv:375 → NO DATA [TRACE] 16:40:39.575 shell.go:Getenv(OMP_CACHE_DISABLED) - 3.6µs [TRACE] 16:40:39.576 shell_unix.go:Root() - 1.2µs [DEBUG] 16:40:39.576 shell.go:Shell:620 → process name: bash [TRACE] 16:40:39.576 shell.go:Shell() - 434.6µs [TRACE] 16:40:39.576 shell.go:ErrorCode() - 100ns [DEBUG] 16:40:39.576 shell.go:Getenv:375 → Ubuntu [TRACE] 16:40:39.576 shell.go:Getenv(WSL_DISTRO_NAME) - 4.2µs [TRACE] 16:40:39.576 shell_unix.go:IsWsl() - 8.1µs [TRACE] 16:40:39.576 shell.go:GOOS() - 0s [DEBUG] 16:40:39.576 shell.go:Pwd:403 → NO DATA [TRACE] 16:40:39.576 shell.go:Pwd() - 18µs [TRACE] 16:40:39.576 shell.go:GOOS() - 100ns [TRACE] 16:40:39.576 shell.go:GOOS() - 0s [TRACE] 16:40:39.576 shell.go:GOOS() - 100ns [TRACE] 16:40:39.576 shell.go:GOOS() - 100ns [TRACE] 16:40:39.576 shell.go:GOOS() - 100ns [TRACE] 16:40:39.576 shell.go:GOOS() - 0s [TRACE] 16:40:39.576 shell.go:GOOS() - 100ns [TRACE] 16:40:39.576 shell.go:GOOS() - 0s [TRACE] 16:40:39.576 shell.go:GOOS() - 0s [TRACE] 16:40:39.576 shell.go:GOOS() - 0s [TRACE] 16:40:39.576 shell.go:GOOS() - 100ns [TRACE] 16:40:39.576 shell.go:GOOS() - 100ns [TRACE] 16:40:39.576 shell.go:GOOS() - 0s [TRACE] 16:40:39.576 shell.go:GOOS() - 0s [DEBUG] 16:40:39.576 shell.go:User:524 → wavesinaroom [TRACE] 16:40:39.576 shell.go:User() - 4.2µs [DEBUG] 16:40:39.576 shell.go:Host:536 → DESKTOP-ILN2ST2 [TRACE] 16:40:39.576 shell.go:Host() - 6.1µs [TRACE] 16:40:39.576 shell.go:GOOS() - 0s [DEBUG] 16:40:39.576 shell_unix.go:Platform:63 → ubuntu [TRACE] 16:40:39.576 shell.go:TemplateCache() - 596.9µs [TRACE] 16:40:39.576 shell.go:Flags() - 100ns [DEBUG] 16:40:39.576 shell.go:Pwd:383 → /home/wavesinaroom [TRACE] 16:40:39.576 shell.go:Pwd() - 4.5µs [TRACE] 16:40:39.576 shell.go:GOOS() - 0s [DEBUG] 16:40:39.576 shell.go:Getenv:375 → NO DATA [TRACE] 16:40:39.576 shell.go:Getenv(SSH_CONNECTION) - 3.7µs [DEBUG] 16:40:39.576 shell.go:Getenv:375 → NO DATA [TRACE] 16:40:39.576 shell.go:Getenv(SSH_CLIENT) - 3.3µs [TRACE] 16:40:39.576 shell.go:TemplateCache() - 200ns [TRACE] 16:40:39.576 shell.go:TemplateCache() - 300ns [TRACE] 16:40:39.576 shell.go:Shell() - 100ns [DEBUG] 16:40:39.577 shell.go:Pwd:383 → /home/wavesinaroom [TRACE] 16:40:39.577 shell.go:Pwd() - 6.6µs [TRACE] 16:40:39.577 shell.go:GOOS() - 100ns [DEBUG] 16:40:39.577 shell.go:Pwd:383 → /home/wavesinaroom [TRACE] 16:40:39.577 shell.go:Pwd() - 5.1µs [TRACE] 16:40:39.577 shell.go:Shell() - 100ns [TRACE] 16:40:39.577 shell.go:Shell() - 100ns [TRACE] 16:40:39.577 shell.go:GOOS() - 100ns [TRACE] 16:40:39.577 shell.go:PathSeparator() - 100ns [TRACE] 16:40:39.577 shell.go:GOOS() - 0s [TRACE] 16:40:39.577 shell.go:GOOS() - 0s [TRACE] 16:40:39.577 shell.go:GOOS() - 100ns [TRACE] 16:40:39.577 shell.go:GOOS() - 100ns [TRACE] 16:40:39.577 shell.go:PathSeparator() - 0s [TRACE] 16:40:39.577 shell.go:PathSeparator() - 100ns [TRACE] 16:40:39.577 shell.go:GOOS() - 0s [TRACE] 16:40:39.577 shell.go:GOOS() - 100ns [TRACE] 16:40:39.577 shell.go:PathSeparator() - 100ns [TRACE] 16:40:39.577 shell.go:GOOS() - 0s [TRACE] 16:40:39.577 shell.go:GOOS() - 0s [TRACE] 16:40:39.577 shell.go:PathSeparator() - 0s [TRACE] 16:40:39.577 shell.go:GOOS() - 0s [TRACE] 16:40:39.577 shell.go:GOOS() - 0s [TRACE] 16:40:39.577 shell.go:PathSeparator() - 100ns [DEBUG] 16:40:39.577 shell.go:Pwd:383 → /home/wavesinaroom [TRACE] 16:40:39.577 shell.go:Pwd() - 4µs [DEBUG] 16:40:39.577 shell.go:Getenv:375 → Ubuntu [TRACE] 16:40:39.577 shell.go:Getenv(WSL_DISTRO_NAME) - 4µs [TRACE] 16:40:39.577 shell_unix.go:IsWsl() - 9.4µs [DEBUG] 16:40:39.579 shell.go:RunCommand:554 → //wsl$/Ubuntu/home/wavesinaroom [TRACE] 16:40:39.579 shell.go:RunCommand(wslpath -m /home/wavesinaroom) - 2.3012ms [TRACE] 16:40:39.579 shell.go:StackCount() - 300ns [TRACE] 16:40:39.579 shell_unix.go:DirIsWritable(/home/wavesinaroom) - 6.9µs [TRACE] 16:40:39.579 shell.go:TemplateCache() - 300ns [TRACE] 16:40:39.579 shell.go:TemplateCache() - 400ns [TRACE] 16:40:39.580 shell.go:Shell() - 500ns [DEBUG] 16:40:39.580 shell.go:Pwd:383 → /home/wavesinaroom [TRACE] 16:40:39.580 shell.go:Pwd() - 12.5µs [TRACE] 16:40:39.580 shell.go:GOOS() - 100ns [DEBUG] 16:40:39.580 shell.go:Getenv:375 → Ubuntu [TRACE] 16:40:39.580 shell.go:Getenv(WSL_DISTRO_NAME) - 7.8µs [TRACE] 16:40:39.580 shell_unix.go:IsWsl() - 15.1µs [DEBUG] 16:40:39.580 shell.go:FileContent:492 ↓ 5.10.16.3-microsoft-standard-WSL2

[TRACE] 16:40:39.580 shell.go:FileContent(/proc/sys/kernel/osrelease) - 98.9µs [TRACE] 16:40:39.580 shell_unix.go:IsWsl2() - 129.3µs [DEBUG] 16:40:39.580 shell.go:Pwd:383 → /home/wavesinaroom [TRACE] 16:40:39.580 shell.go:Pwd() - 6.6µs [DEBUG] 16:40:39.582 shell.go:RunCommand:554 → //wsl$/Ubuntu/home/wavesinaroom [TRACE] 16:40:39.582 shell.go:RunCommand(wslpath -m /home/wavesinaroom) - 2.062ms [TRACE] 16:40:39.582 shell.go:GOOS() - 100ns [DEBUG] 16:40:39.582 shell.go:CommandPath:575 → /usr/bin/git [TRACE] 16:40:39.582 shell.go:CommandPath(git) - 30.3µs [TRACE] 16:40:39.582 shell.go:HasCommand(git) - 34.9µs [DEBUG] 16:40:39.582 shell.go:Pwd:383 → /home/wavesinaroom [TRACE] 16:40:39.582 shell.go:Pwd() - 6.5µs [ERROR] 16:40:39.582 shell.go:HasParentFilePath:708 → stat /.git: no such file or directory [TRACE] 16:40:39.582 shell.go:HasParentFilePath(.git) - 44.5µs [DEBUG] 16:40:39.582 shell.go:Pwd:383 → /home/wavesinaroom [TRACE] 16:40:39.582 shell.go:Pwd() - 4.6µs [TRACE] 16:40:39.582 shell.go:GOOS() - 100ns [TRACE] 16:40:39.582 shell_unix.go:Root() - 900ns [DEBUG] 16:40:39.582 shell.go:Pwd:383 → /home/wavesinaroom [TRACE] 16:40:39.582 shell.go:Pwd() - 3.8µs [TRACE] 16:40:39.582 shell.go:GOOS() - 100ns [TRACE] 16:40:39.582 shell.go:ErrorCode() - 100ns [TRACE] 16:40:39.582 shell.go:TemplateCache() - 200ns [TRACE] 16:40:39.582 shell.go:Shell() - 100ns [TRACE] 16:40:39.582 shell.go:Flags() - 100ns [DEBUG] 16:40:39.582 shell.go:Pwd:383 → /home/wavesinaroom [TRACE] 16:40:39.582 shell.go:Pwd() - 4.2µs [TRACE] 16:40:39.582 shell.go:GOOS() - 100ns [DEBUG] 16:40:39.582 shell.go:Pwd:383 → /home/wavesinaroom [TRACE] 16:40:39.582 shell.go:Pwd() - 3.9µs [DEBUG] 16:40:39.582 shell.go:Pwd:383 → /home/wavesinaroom [TRACE] 16:40:39.582 shell.go:Pwd() - 3.6µs [TRACE] 16:40:39.582 shell.go:GOOS() - 0s [DEBUG] 16:40:39.582 shell.go:Pwd:383 → /home/wavesinaroom [TRACE] 16:40:39.582 shell.go:Pwd() - 3.5µs [DEBUG] 16:40:39.582 shell.go:Pwd:383 → /home/wavesinaroom [TRACE] 16:40:39.582 shell.go:Pwd() - 3.8µs [TRACE] 16:40:39.582 shell.go:GOOS() - 100ns [DEBUG] 16:40:39.582 shell.go:Pwd:383 → /home/wavesinaroom [TRACE] 16:40:39.582 shell.go:Pwd() - 5.8µs [DEBUG] 16:40:39.582 shell.go:Pwd:383 → /home/wavesinaroom [TRACE] 16:40:39.582 shell.go:Pwd() - 10.6µs [TRACE] 16:40:39.582 shell.go:GOOS() - 0s [TRACE] 16:40:39.582 shell.go:Shell() - 100ns [TRACE] 16:40:39.582 shell.go:Flags() - 0s [TRACE] 16:40:39.582 shell.go:TemplateCache() - 100ns [TRACE] 16:40:39.582 shell.go:TemplateCache() - 300ns [TRACE] 16:40:39.583 shell.go:Shell() - 100ns [DEBUG] 16:40:39.583 shell.go:Pwd:383 → /home/wavesinaroom [TRACE] 16:40:39.583 shell.go:Pwd() - 5.1µs [TRACE] 16:40:39.583 shell.go:GOOS() - 100ns [TRACE] 16:40:39.583 shell.go:TemplateCache() - 100ns [TRACE] 16:40:39.583 shell.go:TemplateCache() - 300ns [TRACE] 16:40:39.583 shell.go:Shell() - 200ns [DEBUG] 16:40:39.583 shell.go:Getenv:375 → NO DATA [TRACE] 16:40:39.583 shell.go:Getenv(XDG_CACHE_HOME) - 5.5µs [TRACE] 16:40:39.583 shell_unix.go:CachePath() - 15.8µs [TRACE] 16:40:39.583 shell.go:Flags() - 100ns`

wavesinaroom commented 1 year ago

I think I understand the issue, my $HOME environment variable my not be pointing at my actual home directory, I'm gonna take a lot at it now.

wavesinaroom commented 1 year ago

Hmmm... it does point to /home/wavesinaroom

JanDeDobbeleer commented 1 year ago

@wavesinaroom here's your pointer:

[ERROR] 16:40:39.575 config.go:loadConfig:130 → open /home/wavesinaroom/lambdageneration.omp.json: no such file or directory

Seems that your config isn't where you think it is (or your user can't access it).

wavesinaroom commented 1 year ago

I'm sorry, that was my beginners mistake, my themes were actually somewhere else. Thanks a lot for your quick reply anyway! I'm gonna post about omp on my linkedin profile

github-actions[bot] commented 10 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.