Karl Cassar
Karl Cassar

Reputation: 6473

showing project folder in title bar for Visual Studio Code

Is it possible to show the last folder in the title bar? If you have multiple instances of VS Code open, it is difficult to distinguish between them from the task bar. If both instances are open on say a file called 'main.ts', you will see 'main.ts' in the taskbar item.

Currently, the title would be [filename open] - [folder open] (e.g main.ts - angular2-training. Is it possible to invert them to become [folder open] - [filename open] (e.g angular2-training - main.ts?

Upvotes: 172

Views: 41431

Answers (8)

P Li
P Li

Reputation: 5212

On version 1.13

Go to File > Preferences > Settings, inside UserSettings add this line to the json blob:

"window.title": "${activeEditorLong}"

On version 1.41.1

enter image description here

Upvotes: 41

kolja
kolja

Reputation: 547

Just some tweaks i found out:

  // will not work on workspace settings.json -> only global
  "window.titleBarStyle": "custom",
  // show only the name of the workspace folder in the title bar
  "window.title": "${folderName}",
  // remove the useless icons on the top-right
  "window.commandCenter": false,

  // make left & top green :-)
  "workbench.colorCustomizations": {
    "activityBar.background": "#1e2127",
    "activityBar.foreground": "#95C085",
    "titleBar.activeBackground": "#165900",
    "titleBar.activeForeground": "#ffffff",
  }, 

Upvotes: 5

davnicwil
davnicwil

Reputation: 30957

Use window.title in user/workspace settings

The documentation is here with the full list of options of what can be shown. It's quite flexible.

In your case, to display angular2-training - main.ts you can use this

{
  "window.title": "${rootName}${separator}${activeEditorShort}"
}

Older VS Code versions

The above only works in v1.10 and up. Here's how to do it in older versions:

v1.9, v1.8 - "window.showFullPath": true shows the full path to the current file, so you can at least see the project folder. Note this config is unsupported after v1.10

v1.7 and below - it's not possible

Upvotes: 266

Greg Woods
Greg Woods

Reputation: 2770

Tested in 1.44

The setting which matches the OPs problem... not being able to tell which VS Code editor is which from the taskbar... is:

"window.title": "${folderName} ${separator} ${activeEditorShort}"

I prefer the simpler

"window.title": "${folderName}"

${activeFolderShort} and friends, don't do what I want, as these follow the folder the active file is in. Whereas I want the folder of the whole "project" shown at all times.

Also, when browsing from the taskbar, I don't care what file is active - it is just noise. I care about the project (i.e. folder). On many occasions, every open VS Code will "main.rs" as the active file, so it is pointless to show it!

Editing the settings in json format even includes intellisense now, so you can see all the options without even having to look them up, and they appear as soon you save the settings file. No need to reload. Awesome!

Upvotes: 11

VonC
VonC

Reputation: 1323115

In addition of the setting:

"window.title": "${rootName}${separator}${activeEditorShort}"

You now can configure the separator as well with VSCode 1.45 (April 2020)

Allow customize the window title separator

A new setting window.titleSeparator allows to change the separator that is used in the window title.

By default a dash is used.

Upvotes: 2

Hamed Naeemaei
Hamed Naeemaei

Reputation: 9638

based uploaded image:

1,2: Go to Setting

3: Search windows title in search box

4: Type this statement in windows title box:

${dirty}${separator}${rootName}${separator}${activeEditorShort}

enter image description here

Upvotes: 17

Mark
Mark

Reputation: 180621

v1.31 of vscode added these options to window.title:

There are three new variables that can be used within the window.title setting:

${activeFolderShort}: The name of the folder the file is contained in.

${activeFolderMedium}: The path of the folder the file is contained in, relative to the workspace folder.

${activeFolderLong}: The full path of the folder the file is contained in.

Upvotes: 2

DavidWainwright
DavidWainwright

Reputation: 2935

If you want to be able to identify which project you are working on by looking at the window title bar, one option is to set "window.title" to a custom value in the workspace settings file at

/.vscode/settings.json

If the file doesn't exist, create it, then add the following to it:

{
    "window.title": "<PROJECT NAME> : ${rootName}${separator}${activeEditorShort}"
}

This is a simple solution that works rather well.

Upvotes: 12

Related Questions