Skip to content

Instantly share code, notes, and snippets.

@CN-CODEGOD
Created March 25, 2025 11:57
Show Gist options
  • Save CN-CODEGOD/1e56da4e78d22938d561d8e23447f335 to your computer and use it in GitHub Desktop.
Save CN-CODEGOD/1e56da4e78d22938d561d8e23447f335 to your computer and use it in GitHub Desktop.
oh-my-posh 设置json
基本命令
oh-my-posh init pwsh --config $env:homedir\theme3.json|Invoke-Expression
模板一:添加文字
{
"$schema": "https://raw.githubusercontent.com/JanDeDobbeleer/oh-my-posh/main/themes/schema.json",
"final_space": true,
"version": 3,
"blocks": [
{
"type": "prompt",
"alignment": "left",
"segments": [
{
#选择类型 type 为text
"type": "text",
"style": "plain",
"foreground": "#E06C75",
# 输入text为>
"template": "❯"
}
]
}
]
}
模板2:添加环境变量
{
"$schema": "https://raw.githubusercontent.com/JanDeDobbeleer/oh-my-posh/main/themes/schema.json",
"final_space": true,
"version": 3,
"blocks": [
{
"type": "prompt",
"alignment": "left",
"segments": [
{
#选择类型为
"type": "text",
"style": "plain",
"foreground": "#E06C75",
#设置变量
homedir为变量名
"template": "{{.Env.homedir}}"
}
]
}
]
}
模板三:设置当前播放的音乐
{
"type": "spotify",
"style": "powerline",
"powerline_symbol": "",
"foreground": "#ffffff",
"background": "#1BD760",
"properties": {
"playing_icon": " ",
"paused_icon": " ",
"stopped_icon": " "
}
}
模板四:
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment