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

Support shorter current working directory #149

Closed
deadwards90 opened this issue Nov 13, 2020 · 4 comments
Closed

Support shorter current working directory #149

deadwards90 opened this issue Nov 13, 2020 · 4 comments
Assignees
Labels
🚀 feat New feature

Comments

@deadwards90
Copy link

Prerequisites

  • [ /] I have read and understand the CONTRIBUTING guide
  • [ /] I looked for duplicate issues before submitting this one

Description

It would be really great if we had support for a shorter version of the current working directory as the console title, in particular I'm thinking the ability to just have the name of the current folder.

image

Just as an example, I can't really see what folder I'm in here.

I'm happy to have a go at this myself, but I've never written any go before so it might be a bit of back and forth!

Environment

  • Oh my Posh version: 3.30.* (not sure which one I downloaded but it was a few days ago)
  • Theme: Powerline
  • Operating System: Windows
  • Shell: Powershell
  • Terminal: Windows Terminal
@JanDeDobbeleer
Copy link
Owner

Can do! This is set using the set_console_title property on settings here. We could extend this with a console_title_style property with the following values:

  • path
  • folder

@JanDeDobbeleer JanDeDobbeleer self-assigned this Nov 13, 2020
@JanDeDobbeleer JanDeDobbeleer added the 🚀 feat New feature label Nov 13, 2020
JanDeDobbeleer added a commit that referenced this issue Nov 13, 2020
@catthehacker
Copy link

I've added replacing home directory path with ~ like in prompt: https://github.com/CatTheHacker/oh-my-posh3/blob/520c6e2771110d0e3c3dda48fe7cce3455f45f40/environment.go#L83
and I also was thinking of adding oh-my-fish-like style of prompt (https://github.com/CatTheHacker/oh-my-posh3/blob/520c6e2771110d0e3c3dda48fe7cce3455f45f40/segment_path.go#L82) and terminal title but didn't looked into project to figure out how to make configuration for that yet.

@JanDeDobbeleer
Copy link
Owner

JanDeDobbeleer commented Nov 13, 2020

@catthehacker the replacement of the home path is done in the path segment as the environment needs to return the actual working directory for other tools to work with (which at times, really require the full path as ~ isn't compatible). What we can do is make/extend those function outside of the path segment and reuse them here as well.

@catthehacker
Copy link

@JanDeDobbeleer Not sure if I know how 😄 I was thinking about exporting the path but then the types have to be matched and I haven't dived into whole project to know where is what.

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

No branches or pull requests

3 participants