Andez
Andez

Reputation: 5848

Customising the application name in a vscode workspace

As directed by the VSCode github repo - I have an simple ask. Is it possible to set a human readable application name for a VSCode Workspace?

At the moment, my .code-workspace file looks like.

{
    "folders": [
        {
            "name": "Some project",
            "path": "../some-project"
        }
    ]
}

Having a look through the Settings (File->Preferences->Settings) for the Workspace there is a plethora of settings. Curiously there is an appName environment variable - but surely there should be a way of customising this.

The title bar looks like the following with acme.app (Workspace):

title bar

Curiously the workspace filename is called acme.app.code-workspace.

Upvotes: 1

Views: 689

Answers (1)

Andez
Andez

Reputation: 5848

I spotted window.title in settings when having a look earlier. You can customise it in the code-workspace. I am not sure whether this would be the best way. Would be nice if we could set an environment variable workspaceName or something and use that - if we needed to use elsewhere.

If you add the settings section - then add the window.title it will default the value to ${dirty}${activeEditorShort}${separator}${rootName}${separator}${appName}.

{
    "folders": [
        {
            "name": "Some project",
            "path": "../some-project"
        }
    ]
    "settings": {
        "window.title": "${dirty}${activeEditorShort}${separator}${rootName}${separator}${appName}"
    }
}

Here you can see the following:

dirty - displays an indicator of whether the current file has changed
activeEditorShort - the current file
separator - configured separator i.e. '-'
rootName - defaults to acme.app (Workspace)
appName - defaults to Visual Studio Code

So you could change the rootName to be the human-readable text:

"window.title": "${dirty}${activeEditorShort}${separator}MY SUPER PROJECT${separator}${appName}"

Which gives us:

configured title

Upvotes: 2

Related Questions