Open safakgur opened 5 years ago
This is a good idea, if you can make it being configurable for any pshazz themes, pull-request is welcome.
I achieved this with a user plugin named title
, which I then added to my theme. Here's the code (let me know if you have any improvements):
function pshazz:title:init {
$title = $global:pshazz.theme.title
# default
if(!$title) { $title = 'Console' }
$global:pshazz.title = $title
}
function global:pshazz:title:prompt {
$vars = $global:pshazz.prompt_vars
$vars.keys | % { set-variable $_ $vars[$_] }
$title = $executionContext.InvokeCommand.ExpandString($global:pshazz.title)
$host.ui.rawui.WindowTitle = $title
}
Then in your theme, simply add the plugin to the list of plugins, and add a field for your title; something like "title": "$user@$hostname | $path",
It's especially nice with ConEmu, as this title can be shown in the "status" bar at the bottom of the window.
Note: You can place user plugins in your pshazz/plugins directory.
At the time I created this issue, I was using ConEmu with "Quake mode" enabled and window title added to status bar exactly like @Deide described:
But I'm using Windows Terminal for some time now and it doesn't have a status bar yet. So I disabled this as the tab itself was not really suitable for long paths. I also noticed that I don't find myself wondering the current path so often and I kind of lost my interest in this feature.
I'm not closing the issue in case this is something you want to do at some point but feel free to close it if no one is interested anymore.
Thank you.
Since the default theme displays only the current folder's name, I find it helpful to display the full path of the working directory on the window title (instead of using a theme that displays it inline with every command). Adding
$host.UI.RawUI.WindowTitle = gl
toprompt
achieves that.If you don't find this useful enough to add to pshazz, I'd appreciate any pointers about how to add this to my PS profile without overwriting pshazz.