Closed FlavienMacquignon closed 2 years ago
@FlavienMacquignon I don't right away understand why you prompt differs from the config you're displaying.
The fact the you see the strange characters is because the prompt (on zsh and bash) needs to be escaped. Which obviously looks weird when you run oh-my-posh like this. What does your .zshrc
look like?
Here is my .zshrc
eval "$(oh-my-posh --init --shell zsh --config ~/clean-detailed2.omp.json)"
# Use powerline
USE_POWERLINE="true"
# Source manjaro-zsh-configuration
if [[ -e /usr/share/zsh/manjaro-zsh-config ]]; then
source /usr/share/zsh/manjaro-zsh-config
fi
# Use manjaro zsh prompt
if [[ -e /usr/share/zsh/manjaro-zsh-prompt ]]; then
source /usr/share/zsh/manjaro-zsh-prompt
fi
Just found out while testing that Oh My Posh generate a second configuration file then i tried to load mine and back-it up, here is the generated configuration:
{
"$schema": "https://raw.githubusercontent.com/JanDeDobbeleer/oh-my-posh/main/themes/schema.json",
"blocks": [
{
"alignment": "left",
"newline": true,
"segments": [
{
"background": "#FEF5ED",
"foreground": "#011627",
"leading_diamond": "\ue0b2",
"properties": {
"macos": "\uf179 ",
"template": " {{ if .WSL }}WSL at {{ end }}{{.Icon}}",
"ubuntu": "\uf31b ",
"windows": "\uf871 "
},
"style": "diamond",
"trailing_diamond": "<transparent,#FEF5ED>\ue0b2</>",
"type": "os"
},
{
"background": "#FEF5ED",
"foreground": "#011627",
"leading_diamond": "\ue0b2",
"properties": {
"template": "\uf489 {{ .Name }}"
},
"style": "diamond",
"trailing_diamond": "<transparent,#FEF5ED>\ue0b2</>",
"type": "shell"
},
{
"background": "#516BEB",
"foreground": "#ffffff",
"leading_diamond": "\ue0b2",
"properties": {
"template": "\uf85a CPU: {{ round .PhysicalPercentUsed .Precision }}% | "
},
"style": "diamond",
"type": "sysinfo"
},
{
"background": "#516BEB",
"foreground": "#ffffff",
"properties": {
"template": "MEM: {{ (div ((sub .PhysicalTotalMemory .PhysicalFreeMemory)|float64) 1000000000.0) }}/{{ (div .PhysicalTotalMemory 1000000000.0) }}GB \uf85a "
},
"style": "diamond",
"trailing_diamond": "<transparent,#516BEB>\ue0b2</>",
"type": "sysinfo"
},
{
"background": "#575656",
"foreground": "#d6deeb",
"leading_diamond": "\ue0b2",
"properties": {
"style": "roundrock",
"template": " {{ .FormattedMs }} ",
"threshold": 0
},
"style": "diamond",
"trailing_diamond": "\ue0b0",
"type": "executiontime"
},
{
"background": "#a7970c",
"foreground": "#ffffff",
"powerline_symbol": "\ue0b0",
"properties": {
"apikey": "REDACTED",
"cache_timeout": 10,
"http_timeout": 100,
"location": "REDACTED",
"template": " {{.Weather}} ({{.Temperature}}{{.UnitIcon}}) ",
"units": "metric"
},
"style": "powerline",
"type": "owm"
}
],
"type": "prompt"
},
{
"alignment": "right",
"segments": [
{
"background": "#ffeb3b",
"background_templates": [
"{{if eq \"Charging\" .State.String}}#40c4ff{{end}}",
"{{if eq \"Discharging\" .State.String}}#ff5722{{end}}",
"{{if eq \"Full\" .State.String}}#4caf50{{end}}"
],
"foreground": "#193549",
"powerline_symbol": "\ue0b0",
"properties": {
"charged_icon": "\ue22f ",
"charging_icon": "\ue234 ",
"discharging_icon": "\ue231 ",
"template": " {{ if not .Error }}{{.Icon}}{{.Percentage}}{{ end }}\uf295 "
},
"style": "powerline",
"type": "battery"
},
{
"background": "#8822ee",
"background_templates": [
"{{ if (lt .Signal 60) }}#DDDD11{{ else if (lt .Signal 90) }}#DD6611{{ else }}#11CC11{{ end }}"
],
"foreground": "#222222",
"powerline_symbol": "\ue0b0",
"properties": {
"template": " \ufaa8 {{ .SSID }} {{ .Signal }}% {{ .ReceiveRate }}Mbps "
},
"style": "powerline",
"type": "wifi"
},
{
"background": "#17D7A0",
"foreground": "#011627",
"leading_diamond": "\ue0b2",
"properties": {
"branch_icon": "\ue725 ",
"fetch_stash_count": true,
"fetch_status": true,
"fetch_upstream_icon": true,
"fetch_worktree_count": true,
"template": " {{ .UpstreamIcon }}{{ .HEAD }}{{ .BranchStatus }}{{ 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 }} "
},
"style": "diamond",
"trailing_diamond": "\ue0b0",
"type": "git"
}
],
"type": "prompt"
},
{
"alignment": "left",
"newline": true,
"segments": [
{
"properties": {
"template": "\u256d\u2500"
},
"style": "plain",
"type": "text"
},
{
"properties": {
"template": " \u2665 {{ .CurrentDate | date .Format }} |",
"time_format": "15:04"
},
"style": "plain",
"type": "time"
},
{
"properties": {
"root_icon": "\uf292 ",
"template": " \uf0e7 "
},
"style": "plain",
"type": "root"
},
{
"properties": {
"folder_icon": "\uf07b ",
"folder_separator_icon": " \uf554 ",
"home_icon": "\uf7db ",
"style": "agnoster_full",
"template": " {{ .Path }} "
},
"style": "plain",
"type": "path"
}
],
"type": "prompt"
},
{
"alignment": "left",
"newline": true,
"segments": [
{
"properties": {
"always_enabled": true,
"template": "\u2570\u2500 "
},
"style": "plain",
"type": "exit"
}
],
"type": "prompt"
}
],
"console_title": true,
"console_title_style": "template",
"console_title_template": "{{ .Folder }}",
"osc99": true,
"transient_prompt": {
"background": "transparent",
"foreground": "#FEF5ED",
"template": "\ue285 "
},
"version": 1
}
I'm sorry but I'm having trouble understanding the issue, oh-my-posh needs to migrate the first config you posted to version 1, that's what the second config you posted looks like (and it overwrites the original, bug keeps a backup). So what are you trying to do as it looks correct from my pov?
Ok, so Adding the line : "version": 1,
before the "blocks": [
line in my original config seems to have resolved my issue for the prompt, however, the WIFI block still don't work.
The issue seems related as the way Oh My Posh handle configuration migration since the rewriting of the "new" configuration put the "version": 1
line at the end and this break the configuration
Ok, nevermind, the issue is on my part the default configuration for Manjaro Zsh is still Loaded even if I source Oh My Posh at the end of the .zshrc file. So it's more a PEBKAC than a real issue on Oh My Posh
@FlavienMacquignon the wifi block only works on Windows for now (I think, need to double check).
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.
Code of Conduct
What happened?
Sorry, this is not technically not a bug but creating a issue here seems to be your way of managing support.
I tried to use Oh My Posh on ZSH and Linux Manjaro but everytime i try to source my .zshrc Oh My Posh migrate my config to version 1 and breaking my configuration. Bellow is a sample output of my configuration
As you can see, the output works then the universal shell is selected (except for the WIFI module)
Theme
{ "$schema": "https://raw.githubusercontent.com/JanDeDobbeleer/oh-my-posh/main/themes/schema.json", "final_space": false, "osc99": true, "console_title": true, "console_title_style": "template", "console_title_template": "{{ .Folder }}", "transient_prompt": { "background": "transparent", "foreground": "#FEF5ED", "template": "\ue285 " }, "blocks": [ { "type": "prompt", "alignment": "left", "newline": true, "segments": [ { "type": "os", "style": "diamond", "leading_diamond": "\uE0B2", "trailing_diamond": "<transparent,#FEF5ED>\uE0B2</>", "foreground": "#011627", "background": "#FEF5ED", "properties": { "postfix": "", "windows": "\uf871 ", "macos": "\uf179 ", "ubuntu": "\uf31b " } }, { "type": "shell", "style": "diamond", "leading_diamond": "\uE0B2", "trailing_diamond": "<transparent,#FEF5ED>\uE0B2</>", "foreground": "#011627", "background": "#FEF5ED", "properties": { "prefix": "\uf489 ", "postfix": "" } }, { "type": "sysinfo", "style": "diamond", "leading_diamond": "\uE0B2", "trailing_diamond": "", "foreground": "#ffffff", "background": "#516BEB", "properties": { "prefix": "\uf85a CPU: ", "postfix": "% | ", "template": "{{ round .PhysicalPercentUsed .Precision }}" } }, { "type": "sysinfo", "style": "diamond", "leading_diamond": "", "trailing_diamond": "<transparent,#516BEB>\uE0B2</>", "foreground": "#ffffff", "background": "#516BEB", "properties": { "prefix": "MEM: ", "postfix": "GB \uf85a ", "template": "{{ (div ((sub .PhysicalTotalMemory .PhysicalFreeMemory)|float64) 1000000000.0) }}/{{ (div .PhysicalTotalMemory 1000000000.0) }}" } }, { "type": "executiontime", "style": "diamond", "leading_diamond": "\uE0B2", "trailing_diamond": "\uE0B0", "foreground": "#d6deeb", "background": "#575656", "properties": { "threshold": 0, "style": "roundrock" } }, { "type": "owm", "style": "powerline", "powerline_symbol": "\uE0B0", "foreground": "#ffffff", "background": "#a7970c", "properties": { "apikey": "fREDACTED", "location": "REDACTED", "units": "metric", "enable_hyperlink": true, "http_timeout": 100, "cache_timeout": 10, "template": "{{.Weather}} ({{.Temperature}}{{.UnitIcon}})" } } ] }, { "type": "prompt", "alignment": "right", "newline": false, "segments": [ { "type": "battery", "style": "powerline", "powerline_symbol": "\uE0B0", "foreground": "#193549", "background": "#ffeb3b", "background_templates": [ "{{if eq \"Charging\" .State.String}}#40c4ff{{end}}", "{{if eq \"Discharging\" .State.String}}#ff5722{{end}}", "{{if eq \"Full\" .State.String}}#4caf50{{end}}" ], "properties": { "discharging_icon": "\uE231 ", "charging_icon": "\uE234 ", "charged_icon": "\uE22F ", "postfix": "\uF295 ", "template": "{{ if not .Error }}{{.Icon}}{{.Percentage}}{{ end }}" } }, { "type": "wifi", "style": "powerline", "background": "#8822ee", "foreground": "#222222", "background_templates": [ "{{ if (lt .Signal 60) }}#DDDD11{{ else if (lt .Signal 90) }}#DD6611{{ else }}#11CC11{{ end }}" ], "powerline_symbol": "\uE0B0", "properties": { "template": "\uFAA8 {{ .SSID }} {{ .Signal }}% {{ .ReceiveRate }}Mbps" } }, { "type": "git", "style": "diamond", "leading_diamond": "\uE0B2", "trailing_diamond": "\uE0B0", "foreground": "#011627", "background": "#17D7A0", "properties": { "branch_icon": "\ue725 ", "fetch_status": true, "fetch_stash_count": true, "fetch_worktree_count": true, "fetch_upstream_icon": true, "template": "{{ .UpstreamIcon }}{{ .HEAD }}{{ .BranchStatus }}{{ 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 }}" } } ] }, { "type": "prompt", "alignment": "left", "newline": true, "segments": [ { "type": "text", "style": "plain", "properties": { "prefix": "", "postfix": "", "text": "╭─" } }, { "type": "time", "style": "plain", "properties": { "prefix": " \u2665 ", "postfix": " |", "time_format": "15:04" } }, { "type": "root", "style": "plain", "properties": { "root_icon": "\uf292 " } }, { "type": "path", "style": "plain", "properties": { "folder_separator_icon": " \uf554 ", "home_icon": "\uf7db ", "folder_icon": "\uf07b ", "style": "agnoster_full", "enable_hyperlink": true } } ] }, { "type": "prompt", "alignment": "left", "newline": true, "segments": [ { "type": "exit", "style": "plain", "properties": { "prefix": "", "template": "╰─", "always_enabled": true } } ] } ] }
What OS are you seeing the problem on?
Linux
Which shell are you using?
zsh
Log output