JanDeDobbeleer / oh-my-posh

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

xonsh promt not starting when enabling oh-my-posh #3651

Closed GameTec-live closed 1 year ago

GameTec-live commented 1 year ago

Code of Conduct

What happened?

So a few bugs happen when trying to use the latest version of oh-my-posh (14.21.0) with the latest version of xonsh (xonsh/0.13.4) The first and biggest one: xonsh doesnt start, just hangs when oh-my-posh and xontribs are enabled at the same time... The 2nd one: The colors are wayyyyy off, you cant tell me, that those are the same color (same config file tho): image

Thx for the help in advance...

Theme

{
    "$schema": "https://raw.githubusercontent.com/JanDeDobbeleer/oh-my-posh/main/themes/schema.json",
    "blocks": [
      {
        "alignment": "left",
       "segments": [
          {
            "background": "#29315A",
            "foreground": "#3EC669",
            "leading_diamond": "\ue0b6",
            "style": "diamond",
            "template": "{{ .UserName }}@{{ .HostName }} ",
            "trailing_diamond": "\ue0b4",
            "type": "session"
          },
          {
            "background": "#29315A",
            "foreground": "#3EC669",
            "leading_diamond": "\ue0b6",
            "properties": {
              "style": "full"
            },
            "style": "diamond",
            "template": "\ue5ff {{ .Path }}",
            "trailing_diamond": "\ue0b4",
            "type": "path"
          },
          {
            "background": "#29315A",
            "foreground": "#43CCEA",
            "foreground_templates": [
              "{{ if or (.Working.Changed) (.Staging.Changed) }}#FF9248{{ end }}",
              "{{ if and (gt .Ahead 0) (gt .Behind 0) }}#ff4500{{ end }}",
              "{{ if gt .Ahead 0 }}#B388FF{{ end }}",
              "{{ if gt .Behind 0 }}#B388FF{{ end }}"
            ],
            "leading_diamond": " \ue0b6",
            "properties": {
              "branch_max_length": 25,
              "fetch_stash_count": true,
              "fetch_status": true,
              "fetch_upstream_icon": true
            },
            "style": "diamond",
            "template": " {{ .UpstreamIcon }}{{ .HEAD }}{{if .BranchStatus }} {{ .BranchStatus }}{{ end }}{{ if .Working.Changed }} \uf044 {{ .Working.String }}{{ end }}{{ if and (.Working.Changed) (.Staging.Changed) }} |{{ end }}{{ if .Staging.Changed }} \uf046 {{ .Staging.String }}{{ end }}{{ if gt .StashCount 0 }} \uf692 {{ .StashCount }}{{ end }} ",
            "trailing_diamond": "\ue0b4",
            "type": "git"
          },

          {
            "foreground": "#C94A16",
            "style": "plain",
            "template": "x ",
            "type": "exit"
          }
        ],
        "type": "prompt"
      },
       {
        "alignment": "right",
        "segments": [

          {
            "foreground": "#5fb157",
            "properties": {
              "display_mode": "files",
              "fetch_package_manager": true,
              "fetch_version": true,
              "npm_icon": "<#FE4A49>\ue71e npm</> ",
              "yarn_icon":"<#44FFD2>\uf487 yarn</> "
            },
            "style": "plain",
            "template": "{{ if .PackageManagerIcon }}{{ .PackageManagerIcon }} {{ end }}\ue718 {{ .Full }}",
            "type": "node"
          },
          {
            "foreground": "#4063D8",
            "properties": {
              "display_mode": "files",
              "fetch_version": true
            },
            "style": "plain",
            "template": " {{ if .Error }}{{ .Error }}{{ else }}{{ .Full }}{{ end }}",
            "type": "crystal"
          },
          {
            "foreground": "#DE3F24",
            "properties": {
              "display_mode": "files",
              "fetch_version": true
            },
            "style": "plain",
            "template": " {{ if .Error }}{{ .Error }}{{ else }}{{ .Full }}{{ end }}",
            "type": "ruby"
          },
          {
            "foreground": "#FED142",
            "properties": {
              "display_mode": "context",
              "fetch_virtual_env": false
            },
            "style": "plain",
            "template": " {{ if .Error }}{{ .Error }}{{ else }}{{ .Full }}{{ end }}",
            "type": "python"
          },
          {
            "foreground": "#ca6d16",
            "properties": {
              "display_mode": "context",
              "mapped_shell_names": {
                "pwsh": "\uebc7 PS"
              }
            },
            "style": "plain",
            "template": " {{ if eq .Name \"bash\" }}{{ else }}{{ .Name }} {{ .Version }} {{ end }}",
            "type": "shell"
          }
        ],
        "type": "prompt"
      },
      {
        "alignment": "left",
        "newline": true,
        "segments": [
          {
            "foreground": "#63F08C",
            "style": "plain",
            "template": "\u279c ",
            "type": "text"
          }
        ],
        "type": "prompt"
      }
    ],
    "version": 2
  }

What OS are you seeing the problem on?

Linux

Which shell are you using?

xonsh

Log output

Version: 14.21.0

Shell: xonsh (5.1.16(1)-release)

Segments:

ConsoleTitle(false)                       -   0 ms - 
session(true)                             -   0 ms - benedikt@benedikt-laptop 
path(true)                                -   0 ms -  ~
git(false)                                -   0 ms - 
exit(false)                               -   0 ms - 
node(false)                               -   0 ms - 
crystal(false)                            -   0 ms - 
ruby(false)                               -   0 ms - 
python(false)                             -   0 ms - 
shell(true)                               -   0 ms -  xonsh  
text(true)                                -   0 ms - ➜ 

Run duration: 5.61918ms

Cache path: /home/benedikt/.cache/oh-my-posh

Config path: /home/benedikt/.omp.json

Logs:

[DEBUG] 13:52:05.748 shell.go:Getenv:392 → NO DATA
[TRACE] 13:52:05.748 shell.go:Getenv(TERM_PROGRAM) - 16.681µs
[DEBUG] 13:52:05.748 shell.go:Getenv:392 → NO DATA
[TRACE] 13:52:05.748 shell.go:Getenv(XDG_CACHE_HOME) - 2.434µs
[TRACE] 13:52:05.748 shell_unix.go:CachePath() - 17.512µs
[DEBUG] 13:52:05.750 shell.go:Getenv:392 → /home/benedikt/.omp.json
[TRACE] 13:52:05.750 shell.go:Getenv(POSH_THEME) - 17.493µs
[DEBUG] 13:52:05.750 shell_unix.go:Platform:63 → arch
[TRACE] 13:52:05.750 shell.go:resolveConfigPath() - 27.231µs
[TRACE] 13:52:05.750 shell.go:Init() - 2.263824ms
[TRACE] 13:52:05.750 shell.go:Flags() - 50ns
[TRACE] 13:52:05.751 config.go:loadConfig() - 476.926µs
[TRACE] 13:52:05.751 shell.go:Flags() - 40ns
[DEBUG] 13:52:05.751 shell.go:Getenv:392 → NO DATA
[TRACE] 13:52:05.751 shell.go:Getenv(OMP_CACHE_DISABLED) - 2.875µs
[DEBUG] 13:52:05.752 shell.go:Shell:641 → process name: xonsh
[TRACE] 13:52:05.752 shell.go:Shell() - 1.796416ms
[DEBUG] 13:52:05.752 shell.go:Getenv:392 → 5.1.16(1)-release
[TRACE] 13:52:05.752 shell.go:Getenv(POSH_SHELL_VERSION) - 3.917µs
[TRACE] 13:52:05.752 shell.go:Flags() - 41ns
[TRACE] 13:52:05.752 shell.go:GOOS() - 70ns
[DEBUG] 13:52:05.752 shell.go:Pwd:420 → NO DATA
[TRACE] 13:52:05.752 shell.go:Pwd() - 10.039µs
[TRACE] 13:52:05.752 shell.go:GOOS() - 30ns
[DEBUG] 13:52:05.752 shell.go:Getenv:392 → NO DATA
[TRACE] 13:52:05.752 shell.go:Getenv(SSH_CONNECTION) - 2.525µs
[DEBUG] 13:52:05.752 shell.go:Getenv:392 → NO DATA
[TRACE] 13:52:05.752 shell.go:Getenv(SSH_CLIENT) - 2.294µs
[TRACE] 13:52:05.752 shell_unix.go:Root() - 220ns
[TRACE] 13:52:05.752 shell.go:Shell() - 50ns
[TRACE] 13:52:05.752 shell.go:ErrorCode() - 40ns
[DEBUG] 13:52:05.752 shell.go:Getenv:392 → NO DATA
[TRACE] 13:52:05.752 shell.go:Getenv(WSL_DISTRO_NAME) - 2.204µs
[TRACE] 13:52:05.752 shell_unix.go:IsWsl() - 4.789µs
[DEBUG] 13:52:05.752 shell.go:Pwd:400 → /home/benedikt
[TRACE] 13:52:05.752 shell.go:Pwd() - 3.116µs
[TRACE] 13:52:05.752 shell.go:GOOS() - 30ns
[TRACE] 13:52:05.752 shell.go:GOOS() - 30ns
[TRACE] 13:52:05.752 shell.go:GOOS() - 30ns
[TRACE] 13:52:05.752 shell.go:GOOS() - 30ns
[TRACE] 13:52:05.752 shell.go:GOOS() - 30ns
[TRACE] 13:52:05.752 shell.go:GOOS() - 30ns
[TRACE] 13:52:05.752 shell.go:GOOS() - 30ns
[TRACE] 13:52:05.752 shell.go:GOOS() - 30ns
[TRACE] 13:52:05.752 shell.go:GOOS() - 30ns
[TRACE] 13:52:05.752 shell.go:GOOS() - 30ns
[DEBUG] 13:52:05.752 shell.go:User:545 → benedikt
[TRACE] 13:52:05.752 shell.go:User() - 2.976µs
[DEBUG] 13:52:05.753 shell.go:Host:557 → benedikt-laptop
[TRACE] 13:52:05.753 shell.go:Host() - 4.689µs
[TRACE] 13:52:05.753 shell.go:GOOS() - 30ns
[DEBUG] 13:52:05.753 shell_unix.go:Platform:63 → arch
[TRACE] 13:52:05.753 shell.go:TemplateCache() - 87.585µs
[TRACE] 13:52:05.753 shell.go:TemplateCache() - 110ns
[TRACE] 13:52:05.753 shell.go:Shell() - 50ns
[DEBUG] 13:52:05.753 shell.go:Pwd:400 → /home/benedikt
[TRACE] 13:52:05.753 shell.go:Pwd() - 3.547µs
[TRACE] 13:52:05.753 shell.go:GOOS() - 50ns
[DEBUG] 13:52:05.753 shell.go:Pwd:400 → /home/benedikt
[TRACE] 13:52:05.753 shell.go:Pwd() - 3.747µs
[TRACE] 13:52:05.753 shell.go:Shell() - 30ns
[TRACE] 13:52:05.753 shell.go:Shell() - 30ns
[TRACE] 13:52:05.753 shell.go:GOOS() - 30ns
[TRACE] 13:52:05.753 shell.go:PathSeparator() - 160ns
[TRACE] 13:52:05.753 shell.go:GOOS() - 30ns
[TRACE] 13:52:05.753 shell.go:GOOS() - 30ns
[TRACE] 13:52:05.753 shell.go:GOOS() - 30ns
[TRACE] 13:52:05.753 shell.go:GOOS() - 30ns
[TRACE] 13:52:05.753 shell.go:PathSeparator() - 30ns
[TRACE] 13:52:05.753 shell.go:PathSeparator() - 30ns
[TRACE] 13:52:05.753 shell.go:GOOS() - 30ns
[TRACE] 13:52:05.753 shell.go:GOOS() - 30ns
[TRACE] 13:52:05.753 shell.go:PathSeparator() - 30ns
[TRACE] 13:52:05.753 shell.go:GOOS() - 30ns
[TRACE] 13:52:05.753 shell.go:GOOS() - 31ns
[TRACE] 13:52:05.753 shell.go:PathSeparator() - 30ns
[TRACE] 13:52:05.753 shell.go:GOOS() - 30ns
[TRACE] 13:52:05.753 shell.go:GOOS() - 30ns
[TRACE] 13:52:05.753 shell.go:PathSeparator() - 30ns
[DEBUG] 13:52:05.753 shell.go:Pwd:400 → /home/benedikt
[TRACE] 13:52:05.753 shell.go:Pwd() - 2.866µs
[DEBUG] 13:52:05.753 shell.go:Getenv:392 → NO DATA
[TRACE] 13:52:05.753 shell.go:Getenv(WSL_DISTRO_NAME) - 2.384µs
[TRACE] 13:52:05.753 shell_unix.go:IsWsl() - 5.069µs
[TRACE] 13:52:05.753 shell.go:StackCount() - 60ns
[TRACE] 13:52:05.753 shell_unix.go:DirIsWritable(/home/benedikt) - 5.711µs
[TRACE] 13:52:05.753 shell.go:TemplateCache() - 40ns
[TRACE] 13:52:05.753 shell.go:TemplateCache() - 50ns
[TRACE] 13:52:05.753 shell.go:Shell() - 50ns
[DEBUG] 13:52:05.753 shell.go:Pwd:400 → /home/benedikt
[TRACE] 13:52:05.753 shell.go:Pwd() - 3.256µs
[TRACE] 13:52:05.753 shell.go:GOOS() - 40ns
[DEBUG] 13:52:05.753 shell.go:Getenv:392 → NO DATA
[TRACE] 13:52:05.753 shell.go:Getenv(WSL_DISTRO_NAME) - 2.294µs
[TRACE] 13:52:05.753 shell_unix.go:IsWsl() - 4.899µs
[TRACE] 13:52:05.753 shell_unix.go:IsWsl2() - 7.304µs
[TRACE] 13:52:05.753 shell.go:GOOS() - 30ns
[DEBUG] 13:52:05.753 shell.go:CommandPath:596 → /usr/bin/git
[TRACE] 13:52:05.753 shell.go:CommandPath(git) - 17.342µs
[TRACE] 13:52:05.753 shell.go:HasCommand(git) - 20.338µs
[DEBUG] 13:52:05.753 shell.go:Pwd:400 → /home/benedikt
[TRACE] 13:52:05.753 shell.go:Pwd() - 2.865µs
[ERROR] 13:52:05.753 shell.go:HasParentFilePath:729 → stat .git: no such file or directory
[TRACE] 13:52:05.753 shell.go:HasParentFilePath(.git) - 19.978µs
[DEBUG] 13:52:05.753 shell.go:Pwd:400 → /home/benedikt
[TRACE] 13:52:05.753 shell.go:Pwd() - 2.975µs
[TRACE] 13:52:05.753 shell.go:GOOS() - 40ns
[TRACE] 13:52:05.753 shell.go:ErrorCode() - 30ns
[TRACE] 13:52:05.753 shell.go:ErrorCode() - 30ns
[TRACE] 13:52:05.753 shell.go:Flags() - 40ns
[DEBUG] 13:52:05.753 shell.go:Pwd:400 → /home/benedikt
[TRACE] 13:52:05.753 shell.go:Pwd() - 2.875µs
[TRACE] 13:52:05.753 shell.go:GOOS() - 30ns
[DEBUG] 13:52:05.753 shell.go:Pwd:400 → /home/benedikt
[TRACE] 13:52:05.753 shell.go:Pwd() - 3.306µs
[DEBUG] 13:52:05.753 shell.go:Pwd:400 → /home/benedikt
[TRACE] 13:52:05.753 shell.go:Pwd() - 2.836µs
[TRACE] 13:52:05.753 shell.go:GOOS() - 30ns
[DEBUG] 13:52:05.753 shell.go:Pwd:400 → /home/benedikt
[TRACE] 13:52:05.753 shell.go:Pwd() - 2.956µs
[DEBUG] 13:52:05.753 shell.go:Pwd:400 → /home/benedikt
[TRACE] 13:52:05.753 shell.go:Pwd() - 2.795µs
[TRACE] 13:52:05.753 shell.go:GOOS() - 20ns
[DEBUG] 13:52:05.753 shell.go:Pwd:400 → /home/benedikt
[TRACE] 13:52:05.753 shell.go:Pwd() - 2.775µs
[DEBUG] 13:52:05.753 shell.go:Pwd:400 → /home/benedikt
[TRACE] 13:52:05.753 shell.go:Pwd() - 2.865µs
[TRACE] 13:52:05.753 shell.go:GOOS() - 30ns
[DEBUG] 13:52:05.753 shell.go:Pwd:400 → /home/benedikt
[TRACE] 13:52:05.753 shell.go:Pwd() - 2.755µs
[DEBUG] 13:52:05.753 shell.go:Pwd:400 → /home/benedikt
[TRACE] 13:52:05.753 shell.go:Pwd() - 2.806µs
[TRACE] 13:52:05.753 shell.go:GOOS() - 30ns
[TRACE] 13:52:05.753 shell.go:Shell() - 50ns
[TRACE] 13:52:05.753 shell.go:Flags() - 40ns
[TRACE] 13:52:05.753 shell.go:TemplateCache() - 50ns
[TRACE] 13:52:05.753 shell.go:TemplateCache() - 50ns
[TRACE] 13:52:05.753 shell.go:Shell() - 60ns
[TRACE] 13:52:05.753 shell.go:Flags() - 40ns
[DEBUG] 13:52:05.753 shell.go:Pwd:400 → /home/benedikt
[TRACE] 13:52:05.753 shell.go:Pwd() - 4.639µs
[TRACE] 13:52:05.753 shell.go:GOOS() - 40ns
[TRACE] 13:52:05.753 shell.go:TemplateCache() - 40ns
[TRACE] 13:52:05.753 shell.go:Shell() - 40ns
[DEBUG] 13:52:05.753 shell.go:Getenv:392 → NO DATA
[TRACE] 13:52:05.753 shell.go:Getenv(XDG_CACHE_HOME) - 2.555µs
[TRACE] 13:52:05.753 shell_unix.go:CachePath() - 11.241µs
[TRACE] 13:52:05.753 shell.go:Flags() - 40ns
JanDeDobbeleer commented 1 year ago

@GameTec-live which xontribs do you have active?

GameTec-live commented 1 year ago

just some default / recommended ones, which you get the choose from when setting up xonsh... (i think its autovox, vox, voxapi, coreutils and bashisms?)

JanDeDobbeleer commented 1 year ago

@GameTec-live the colors is a xonsh bug/configuration issue. We output the same colors regardless of the shell used. About the config changes not popping up, can you share your ~/.xonshrc?

GameTec-live commented 1 year ago

@JanDeDobbeleer sure

# my aliases
aliases['forceless'] = '/usr/bin/less'
aliases['forcenano'] = '/usr/bin/nano'
aliases['forcevi'] = '/usr/bin/vi'

aliases['cls'] = 'clear'
aliases['uet'] = 'yay -Syu --noconfirm && flatpak update -y && exit'
aliases['less'] = 'moar'
aliases['la'] = 'ls -la'
aliases['ll'] = 'ls -la'
aliases['nano'] = 'code'
aliases['vi'] = 'code'
aliases['vim'] ='code'
aliases['powershell'] = 'pwsh'
aliases['sewnow'] = 'cd ~/Documents/schule/SEW1/c/ && code . && exit'

# extensions
xontrib load autovox
xontrib load vox
xontrib load voxapi
xontrib load bashisms
xontrib load coreutils

#execx($(oh-my-posh init xonsh --config ~/.omp.json))
JanDeDobbeleer commented 1 year ago

@GameTec-live it seems that xontrib load coreutils is the culprit here. See this issue as well, where it's also stated you don't need this on Linux based systems.

GameTec-live commented 1 year ago

ok, thanks... any idea on how i can fix the colors? (even tough that would be a xonsh issue?)

JanDeDobbeleer commented 1 year ago

@GameTec-live no clue, tried to have a search for that but couldn't find it.

GameTec-live commented 1 year ago

@GameTec-live no clue, tried to have a search for that but couldn't find it.

gooeing didnt show anything for me too, so... too the xonsh issue tracker ig?

JanDeDobbeleer commented 1 year ago

I would indeed ask over there.

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