JanDeDobbeleer / oh-my-posh

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

Can't set custom title #4954

Closed NebularNerd closed 5 months ago

NebularNerd commented 5 months ago

Code of Conduct

What happened?

This is more likely a user issue than a bug.

I use a small script to change the title of the currently open shell:

param([string]$a)
$host.ui.RawUI.WindowTitle = $a

But with oh-my-posh this no longer works as it override anything I set. How do I disable or replicate this functionality in oh-my-posh?

Theme

This is more likely a user issue than a bug.

I use a small script to change the title of the currently open shell:

param([string]$a)
$host.ui.RawUI.WindowTitle = $a

This allows me to name each tab either manually or through a currently running script (e.g. Dave, GitHub Thing etc...) But with oh-my-posh this no longer works as it override anything I set. How do I disable or replicate this functionality in oh-my-posh?

What OS are you seeing the problem on?

Windows

Which shell are you using?

powershell

Log output

n/a as not an error
JanDeDobbeleer commented 5 months ago

If you remove the console title template, this will work (or adjust the title template to display what you need).

NebularNerd commented 5 months ago

Found it, it was at the bottom of the theme file not the top. Knew it was me 😂

Is there a way to set the ability for oh-my-posh to control the console title while running?

JanDeDobbeleer commented 5 months ago

You can always set an environment variable which can be used in the title template.

NebularNerd commented 5 months ago

OK, so if I set: "console_title_template": "{{.Env.MYTITLE}}"

Then set an env variable with $Env:MYTITLE = "Powershell - Awesome Title"

That's going to change all tabs, not just the open one.

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