Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Full CWD path on window title #94

Open
safakgur opened this issue Apr 12, 2019 · 3 comments
Open

Full CWD path on window title #94

safakgur opened this issue Apr 12, 2019 · 3 comments

Comments

@safakgur
Copy link

safakgur commented Apr 12, 2019

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 to prompt 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.

@chawyehsu
Copy link
Collaborator

This is a good idea, if you can make it being configurable for any pshazz themes, pull-request is welcome.

@Deide
Copy link
Contributor

Deide commented May 5, 2019

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.

@safakgur
Copy link
Author

safakgur commented Apr 6, 2020

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:

image

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.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

3 participants