vscode icon indicating copy to clipboard operation
vscode copied to clipboard

Allow to configure title bar information

Open alexdresko opened this issue 10 years ago • 43 comments

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

alexdresko avatar Dec 31 '15 13:12 alexdresko

@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.

alexdresko avatar Apr 01 '16 13:04 alexdresko

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 avatar Apr 02 '16 06:04 bpasero

+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.

jamietre avatar Aug 09 '16 15:08 jamietre

https://github.com/Microsoft/vscode/issues/12625 for the issue to show the full path in the title bar. This might resolve many (but not all) concerns of this issue.

bpasero avatar Nov 01 '16 21:11 bpasero

@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

jamietre avatar Nov 02 '16 13:11 jamietre

@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.

bpasero avatar Nov 02 '16 17:11 bpasero

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

jamietre avatar Nov 02 '16 18:11 jamietre

@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?

bpasero avatar Nov 02 '16 18:11 bpasero

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.

jamietre avatar Nov 02 '16 18:11 jamietre

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.

bpasero avatar Nov 02 '16 18:11 bpasero

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}"

ghost avatar Nov 03 '16 09:11 ghost

@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 :)

jamietre avatar Nov 03 '16 12:11 jamietre

@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.

alexdresko avatar Nov 03 '16 13:11 alexdresko

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

jamietre avatar Nov 03 '16 13:11 jamietre

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.

saborrie avatar Nov 19 '16 21:11 saborrie

+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.

paulX7 avatar Nov 24 '16 17:11 paulX7

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.

gilboa23 avatar Jan 15 '17 13:01 gilboa23

From the discussion I can see the following template variables as being considered useful:

  • {activeFileName}: e.g. myFile.txt
  • {activeFilePath}: e.g. /Users/Development/myProject/myFile.txt
  • {workspaceName}: e.g. myProject
  • {workspacePath}: e.g. /Users/Development/myProject
  • {appName}: e.g. VS Code

(the current git branch is not straight forward to add for layering issues but maybe later)

There is still something not clear to me: We will probably soon support multiple root folders per workspace. In that case {workspaceName} or {workspacePath} do not make much sense. If I had the folders myProject and otherProject open in the same window, I would probably expect the title to show me myProject, otherProject. In that case, showing the full path of both does not make much sense either. Maybe instead of {workspaceName} it should rather be called {projectName}. {workspacePath} could be {projectPath} and be somehow smartly computed from the root folders (however that works...).

bpasero avatar Jan 21 '17 10:01 bpasero

I think of workspaces as more of a conceptual entity - like how I can have a VS .SLN with a name that is completely different from the containing folder. If you're going to allow multiple folders, you're essentially creating something similar to a VS .SLN, right? That workspace name is something we'd want to add to the title bar, as we as, separately, the path to the workspace file. At that point, the folders in the workspace don't really matter. I don't expect VS to show me the path to all of the projects in the .SLN in the title bar. The name and path to the currently open file are important though.

alexdresko avatar Jan 21 '17 17:01 alexdresko

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 https://github.com/Microsoft/vscode/issues/20016 to follow up.

bpasero avatar Feb 06 '17 08:02 bpasero