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

Allow to configure title bar information #1723

Closed
alexdresko opened this issue Dec 31, 2015 · 43 comments
Closed

Allow to configure title bar information #1723

alexdresko opened this issue Dec 31, 2015 · 43 comments
Assignees
Labels
feature-request Request for new features or functionality
Milestone

Comments

@alexdresko
Copy link

It would be great if we could configure the information that gets displayed in the title bar. I use ManicTime a lot, and it's hard to auto tag my activities when the title bar basically only displays the file name and root folder name. Having the full path to the file and the git branch name would be super helpful.

For some other ideas, this VS plugin is super rad and affords complete control over what gets displayed in the title bar. https://visualstudiogallery.msdn.microsoft.com/2e8ebfe4-023f-4c4d-9b7a-d05bbc5cb239

@bpasero bpasero changed the title More information in the title bar, please. Allow to configure title bar information Jan 3, 2016
@bpasero bpasero added feature-request Request for new features or functionality workbench labels Jan 3, 2016
@bpasero bpasero added this to the Backlog milestone Jan 3, 2016
@bpasero bpasero added the help wanted Issues identified as good community contribution opportunities label Feb 8, 2016
@bpasero bpasero self-assigned this Mar 30, 2016
@alexdresko
Copy link
Author

@bpasero By assigning this to yourself, does that mean it might happen? If so, please let me know if you would like some help, even if it's just for feedback.

@bpasero
Copy link
Member

bpasero commented Apr 2, 2016

This issue is currently assigned to the backlog. Every sprint we pick items from the backlog to plan for the current iteration. Please see https://github.com/Microsoft/vscode/wiki/Issue-Tracking#planning

@bpasero bpasero removed the help wanted Issues identified as good community contribution opportunities label Jul 12, 2016
@jamietre
Copy link

jamietre commented Aug 9, 2016

+1. The more I use VS Code on bigger projects, it's becoming frustrating to be unable to distinguish between open windows. I wish I could configure the title to just show [Root Folder] - [File], since it's hard to distinguish between open projects when the file name is shown first. But some simple templating system would probably solve everyone's problem.

@bpasero
Copy link
Member

bpasero commented Nov 1, 2016

#12625 for the issue to show the full path in the title bar. This might resolve many (but not all) concerns of this issue.

@jamietre
Copy link

jamietre commented Nov 2, 2016

@bpasero i do appreciate the effort but actually this still does not address the issue (at least as far as Windows) is concerned. It may actually make it worse (though since it's an option that's not an issue).

The problem is that in Windows, the taskbar shows a preview of all windows for a given application, and there is only limited space to show the title. Showing the full path would give me exactly the opposite problem I have now: I'd just see the part of the path, starting with the root, that fits in the display. So with this enabled, I'd most likely have no information at all about which window was which, since they likely all share a common root path.

What is really needed is the ability to show project-root/../filename or project-root * filename. The parent folder is nearly always the identifying feature for a project. I don't even care if the filename gets cut off- because I really just want to be able to determine which project is open from the title bar.

In the example below the only one I can tell which project is open is iter8 because the file name happens to be very short. But even when it's visible, it's hard to visually parse because it's not aligned to anything. I want the project root folder on the left (instead of after the filename) so it is always visible.

image

@bpasero
Copy link
Member

bpasero commented Nov 2, 2016

@jamietre we can still tweak this experience and I welcome the problem description you gave, though I am not sure how to best solve it.

Here is how your scenario looks like without the new option enabled:

image

And here with the option turned on:

image

This makes it hard to see the currently opened file but you can easily see the full path when you compare the 2 window titles in full (not from this experience).

I think this feature request is still valid for that particular scenario because you could then really compose the title you want, I am not sure we should change the experience by default with the new option.

I am open for suggestions though if the default experience when this new option is turned on should be changed.

@jamietre
Copy link

jamietre commented Nov 2, 2016

Thanks for all the feedback, it's very appreciated.

In my case almost all my code is under a single heirarchy like d:/users/jtreworgy/code/... -- so if I were lucky I might get a few characters of the root folder. But I also work in subfolders with groups of projects, too, so it would be quite realistic for there to be nothing unique at all. I could try to keep everything under shallow heirarchies but I guess I'd rather not have to design my file system architecture around accomodating VS Code ;)

The perfect world for me would be the ability to pass a template like "{rootFolder} - {fileName}" instead of boolean options for predefined templates. Just having rootFolder, fileName and fullPath as available parameters would accomodate everything that's been discussed here as well as the current state.

Even more perfect world, the ability to invoke a javascript function that I wrote to return my title given the path as input :) but then I've written a plugin haven't I..

@bpasero
Copy link
Member

bpasero commented Nov 2, 2016

@jamietre but how is root folder solving it when you have 2 workspaces with the same name in different hierarchies?

"{rootFolder} - {fileName}" isn't that what we are showing today without the full path option enabled?

@jamietre
Copy link

jamietre commented Nov 2, 2016

I wasn't considering that possibility - I would never have two workspaces with the same name open (or at least, it's not particularly likely, maybe if I was trying to deep dive some comparison between two branches?). But that's not my problem generally... if that is an issue for some people, perhaps a possible solution is to also display a numerical index identifying which was opened first? Can VS code instances know anything about each other?

But anyway -- right now the problem is the root folder appears last, e.g. {fileName} - {rootFolder} so it is cut off for long file names (which are pretty common in our projects). And it's hard to parse them even if they are visible when they aren't left-aligned.

@bpasero
Copy link
Member

bpasero commented Nov 2, 2016

Oh yeah, that is true. I was not thinking about the fact that the file name comes first. We cannot change that without making it hard for users that want to quickly glance at the file name in that scenario so I guess no matter what it boils down to making it configurable if any.

I still think the setting to show a full path is a good one, so I will keep it as is for now and we leave this one here open.

@ghost
Copy link

ghost commented Nov 3, 2016

I would really love to hve an option/config to at least show {rootFolder} first. event if its just that (don't really see the point of having the filename in the title bar. For me the next most useful information would be the git branch name: "{rootFolder} - {branchName}"

@jamietre
Copy link

jamietre commented Nov 3, 2016

@Cedric-Venet agreed. If VS Code allowed you to drag a file out to start a new window, I could see how that might be useful to some. But you can't -- so it just doesn't seem likely that's what many people are looking for a file name when trying to discriminate between open instances.

I looked at the code that creates the window title invs/workbench/services/history/browser/history.ts... it seems straightforward and I am sure I could handle the change to support user-provided templates if this change would be accepted. @bpasero would you be interested in a PR? I have no idea what the overhead is in getting set up to create vs code builds - if you can convince me it's not too bad I'm willing to take a shot :)

@alexdresko
Copy link
Author

@jamietre Dunno if this exactly deals with one of your use cases, but there's a plugin called "Open Folder Context Menus for VS Code" that "Quickly opens a new instance of VS Code from the Explorer". Works pretty well for me.

@jamietre
Copy link

jamietre commented Nov 3, 2016

@alexdresko the problem isn't opening VSCode, it's finding the correct instance among a bunch of already opened ones.

@saborrie
Copy link

saborrie commented Nov 19, 2016

I often have multiple windows of VSCode open. Until I found this issue I'd had a different thought on how to solve it: setting a workspace/folder colour.

I commonly have one window using the integrated debugging feature for a backend written in NodeJs. The bottom bar goes orange when debugging, and I've been using that help distinguish which is which.

You can see this in a picture already posted in this thread:

I tend to switch between full-screen windows using the keyboard, rather than hovering on the taskbar to select a window. But even when flicking between full-screen windows, it's not always clear where you've switched to. And while being able to customise the title of the window would give me somewhere to glance at, I think that colourising some part of the window would allow for even quicker discerning of which instance has been focused.

Although the title of this issue is "Allow to configure title bar information" I figured that my suggestion probably belonged here at first rather than in it's own issue, since the other comments here have equated this issue to "Allow to configure easy distinction between open windows". But I can create a new issue if others agree with my suggestion but don't want to lump the two together.

@paulX7
Copy link

paulX7 commented Nov 24, 2016

+1. I frequently work on multiple sub-projects of a large project at the same time. {filename} - {root folder} doesn't help because, for other reasons, all of my root folders are 'src' in VSCode for each of my projects.

@gilboa23
Copy link

The ability to configure the window title to show "{rootFolder} - {fileName}" or even better just "{rootFolder}" instead of "{fileName} - {rootFolder}" is critical for us. We're working in a multiple project setup in Windows and it is currently impossible to distinguish open vscode windows on the taskbar.

This seems to be a rather trivial configuration option to implement, but it adds tremendous usability value.

@bpasero bpasero self-assigned this Feb 6, 2017
@bpasero
Copy link
Member

bpasero commented Feb 6, 2017

I settled on the following solution: there is a new setting window.title (the previous window.showFullPath is no longer supported) that allows to configure the title based on some variables.

Variables are declared using ${} syntax and the following are available:

  • ${activeEditorName}: e.g. myFile.txt
  • ${activeFilePath}: e.g. /Users/Development/myProject/myFile.txt
  • ${rootName}: e.g. myProject
  • ${rootPath}: e.g. /Users/Development/myProject
  • ${appName}: e.g. VS Code
  • ${dirty}: a dirty indicator if the active editor is dirty
  • ${separator}: a conditional separator (" - ") that only shows when surrounded by variables with values

Default values on the various OS:

macOS:
${activeEditorName}${separator}${rootName}

Linux/Windows:
${dirty}${activeEditorName}${separator}${rootName}${separator}${appName}

Since the original request asks also to see the git branch information in the title, I extracted #20016 to follow up.

@alexdresko
Copy link
Author

Is this in the latest insiders build?

@bpasero
Copy link
Member

bpasero commented Feb 6, 2017

@alexdresko it will be tomorrow.

I did a slight update to let the variables be ${} instead of $().

Happy for everyones feedback once this is out.

@jamietre
Copy link

jamietre commented Feb 7, 2017

w00t! THANK YOU!!

image

I am 99.5% happy with this. The last .5% is that (of course) it would be nice to be able to use a Javascript function that gets called with these arguments, instead of just a string template, so i could do fancy things like include the last 2 segments of the path... handle certain types of things differently (e.g. modules vs. apps), etc.

But this is definitely just being greedy, and probably everyone has better things to do now. :) This absolutely solves the problem for me, I can figure out at a glance which window I'm looking for. Best Tuesday ever!

@bpasero
Copy link
Member

bpasero commented Feb 7, 2017

Yeah, I can see how a scripted solution would be better, but let's see how far we get with this approach for now.

@jamietre
Copy link

jamietre commented Feb 7, 2017

It would be a more universal solution to this kind of thing, generally, but I assume it involves some kind of infrastructure change or new convention, since config is json & not js.

Really just threw that out there for long-term consideration. I'm very happy with the way this is working.

@bpasero
Copy link
Member

bpasero commented Feb 7, 2017

Actually I wonder if ${separator} should be dropped, it seems there is really only one usecase for it: to separate between 2 variables if (and only if) both variables are present:

${foo}{separator}${bar}

Why not just automatically add a separator if there is ${foo}${bar}? Makes it easier to read and gets rid of a complicated and confusing variable.

@jamietre
Copy link

jamietre commented Feb 7, 2017

You might not always want it, e.g. ${dirty}${foo}

@bpasero
Copy link
Member

bpasero commented Feb 7, 2017

Hm yeah 💩

@gilboa23
Copy link

gilboa23 commented Feb 8, 2017 via email

@tommck
Copy link

tommck commented Feb 15, 2017

I really like it. Thank you for this update.

You might want to think about allowing people to add parsing logic (too much?)

In my case, our code is laid out like:

/path/to/project/[Branch Name]

So, using {rootPath} is nice, but I'd like to trim "[Branch Name]" off most of the time.

It might be a bit much to support this though

@tommck
Copy link

tommck commented Feb 15, 2017

UPDATE: Ignore this - not a problem

This doesn't seem to be working for me. I'm not seeing the file name first.. just seeing

"C:\Path\To\Project - Visual Studio Code - Insiders"

"window.title": "${dirty}${activeEditorName}${separator}${rootPath}${separator}${appName}",

I restarted the app and opened various files.

Also, does it require a restart to work? Kind of hard to test what you're doing that way

@alexdresko
Copy link
Author

alexdresko commented Feb 15, 2017

Pro tip: You won't see the setting changes when editing the settings file. You have to switch to another file in your workspace to see the changes you've made in the settings. Not sure why that is exactly.

And it does not require a restart.

@tommck
Copy link

tommck commented Feb 15, 2017

The tooltip help for it isn't formatting properly either :)
Should I open a bug?

image

@tommck
Copy link

tommck commented Feb 15, 2017

Huh.. I think it's actually updating, but taking a LONG time to do so on this machine. So, I think my problem with the title bar is not a problem.

@tommck
Copy link

tommck commented Feb 15, 2017

Hmm.. now we just need this feature for the "recent window" list, which just shows the folder name for me, which isn't specific enough (lots of "main" listed in there)

@bpasero
Copy link
Member

bpasero commented Feb 22, 2017

Small update, I added ${activeFilePathRelative} to be able to show a shorter path to the active opened file if the file is from within the workspace opened. E.g. instead of /Users/Development/myProject/myFolder/myFile.txt showing myFolder/myFile.txt if myFolder is opened. Together with ${rootName} this allows to show a file path as myProject/myFolder/myFile.txt if desired.

@bpasero
Copy link
Member

bpasero commented Feb 24, 2017

Another update after feedback from testing during this week from the team: ${activeFilePath} and ${activeFilePathRelative} are working only if a file is opened, making the configuration of the window.title hard when non-file editors are opened.

I decided to revisit the variables around file paths and change them because things are getting complicated when an editor is not showing a file.

Here is my new solution:

  • ${activeEditorLong}: e.g. /Users/Development/myProject/myFolder/myFile.txt
  • ${activeEditorMedium}: e.g. myFolder/myFile.txt
  • ${activeEditorShort}: e.g. myFile.txt

If there is no long editor label, the medium one will be used. And the same is true for medium and short.

Basically:

  • replace ${activeFilePath} with ${activeEditorLong}
  • replace ${activeFilePathRelative} with ${activeEditorMedium}

I hope this works for everyone, should be available in today's insider build.

@nfour
Copy link

nfour commented Feb 24, 2017

@bpasero is there a way to remove the [Unsupported] suffix in the title, when vscode has a modified installation (I'm using custom CSS)?

Looks like MyFancyProject [Unsupported] in the title bar.

@bpasero
Copy link
Member

bpasero commented Feb 24, 2017

No, we strongly advice against using extensions that modify our bits so it is in the best interest to show this not only to you as a user but also to us when we have to investigate bugs which are caused by extensions that patch our bits.

@VojtechVitek
Copy link

VojtechVitek commented Mar 22, 2017

@bpasero "window.title" is a neat addition, thanks. Can we have something similar for tabs?

screen shot 2017-03-22 at 2 12 13 pm

I'd love to see the last directory name as a prefix to the filename on all tabs.

Vim tabs are very smart about tab names btw.

@bpasero
Copy link
Member

bpasero commented Mar 23, 2017

Yeah this was reported already as feature request.

@nileshp87
Copy link

I made a quick extension for setting the title for the workspace: https://marketplace.visualstudio.com/items?itemName=nilpatel.title

Those who find this thread may find it useful.

@VojtechVitek
Copy link

@nileshp87 works great, thank you!

screen shot 2017-04-26 at 7 15 02 pm

@vscodebot vscodebot bot locked and limited conversation to collaborators Nov 18, 2017
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
feature-request Request for new features or functionality
Projects
None yet
Development

No branches or pull requests