如何让Oh-My-Posh不要更改终端标题

前几天用了Oh-My-Posh,很美观,但是有个问题:默认的配置会实时更改Terminal的标题,就像这样

把shell名称改为当前目录的名称。我很不喜欢这一点,我想让它一直显示当前shell的名字,例如powershell,像这样(解决后的样子)

于是尝试更改配置,最终发现解决方法。

更改你使用的omp主题文件*.omp.json内容:

1
2
3
4
{
"$schema": "https://raw.githubusercontent.com/JanDeDobbeleer/oh-my-posh/main/themes/schema.json",
"console_title_template": "{{if .Segments.Git.RepoName}} {{.Segments.Git.RepoName}} {{else}} {{.Folder}} {{end}}"
}

"console_title_template"的值删掉,即:

1
2
3
4
{
"$schema": "https://raw.githubusercontent.com/JanDeDobbeleer/oh-my-posh/main/themes/schema.json",
"console_title_template": ""
}

即可实现omp不更改终端标题。