Currently, to customize the console title we are limited to console_title_style path/folder. That is somewhat limiting; adding a simple "Administrator: " prefix is not possible.
It would be nice to customize it using (go) template or using a block construct that already exists (limiting it to a plain string).
@rgl can you create a few use-cases you see as possibilities? As it doesn't fit into the way segments work (in terms of styling etc), it could be an entirely custom object that maybe reuses some of the concepts.
I only have a use-case: add a custom prefix (or suffix) to the title bar when the current user has administrator privileges.
For example, I would like to show the following title text:
C:\vagrant :: Admin :: PowerShell
That is showing 3 parts: the current path (C:\vagrant), when I run as administrator the :: Admin text, then the shell name :: PowerShell.
Some potential implementations could use a go text/template syntax, or a more structured block syntax.
Using a go text/template this might be:
{{ path }}{{ if root }} :: Admin{{ end }} :: {{ shell }}
Using blocks this might be:
"title": [
{
"type": "path"
},
{
"type": "root",
"text": " :: Admin"
},
{
"type": "shell",
"text": " :: {{ shell }}"
}
]
In theory, everything that is currently available/displayed in the prompt, should be allowed in the title.
Please note that I'm not aware of all the possibilities that we have on modifying the terminal title bar. For example, the new windows terminal might allow us to change the window/tab icon.
In that case I would opt for 1 template option that facilitates a few of these basic cases. The reason is that getting information potentially slows down the prompt so I want to be really careful in allowing what we show there. But we can for sure offer what you're looking for, and more 馃槵
@rgl the preparations have been done, I needed to clean some logic before continuing with this. I'll try to finish it asap.
working nicely! thank you! :-)