fabiospampinato / vscode-terminals

An extension for setting-up multiple terminals at once, or just running some commands.
MIT License
121 stars 19 forks source link

Color and icon is not applied #77

Open alextegelid opened 1 year ago

alextegelid commented 1 year ago

Color and icon for the terminals is not working. Setting "color": "#00ff00" or "icon": "github" for example doesn't do anything. I've debugged a bit and I can see the colors and icons being set on the terminals, but it's not shown on the actual terminal icon.

Here you can see the color being included in the creationOptions:

CleanShot 2022-09-01_06 17 05@2x

My terminals.json:

{
  "autorun": true,
  "autokill": true,
  "terminals": [
    {
      "name": "Next",
      "commands": ["npm run dev"],
      "color": "#ff0000"
    },

    {
      "name": "Util",
      "color": "#ff0000"
    }
  ]
}
StoryDevOffical commented 1 year ago

Hello,

Same here.

On Windows: only icon works but no color applied (terminal.ansiBlue or #ee3355ff) On MacOSX: no icon and no color working

SGirousse commented 1 year ago

Hello,

From my end (Windows 10), colors and icons are visible for like half a second and then seems to be reset to default.

StoryDevOffical commented 1 year ago

true, same behavior on MAC, now i saw it(icon and color) too before reset to default.

Safimmi commented 1 year ago

Same here, both mac and windows

arthurfincham commented 1 year ago

It seems like the customisations are applied at first and then overruled - probably related to July 2022 release of VS Code with default integrated terminal color and icon settings...

https://code.visualstudio.com/updates/v1_70#_default-color-and-icon-tab-settings

alextegelid commented 1 year ago

Indeed it seems to be related to that update. I just tried it on 1.69.1 and that works fine. Maybe this is a bug in VS Code then...

SGirousse commented 1 year ago

Indeed it seems to be related to that update. I just tried it on 1.69.1 and that works fine. Maybe this is a bug in VS Code then...

I'm on fresh and recent install (1.71.2) :

Version: 1.71.2 (user setup)
Commit: 74b1f979648cc44d385a2286793c226e611f59e7
Date: 2022-09-14T21:03:37.738Z
Electron: 19.0.12
Chromium: 102.0.5005.167
Node.js: 16.14.2
V8: 10.2.154.15-electron.0
OS: Windows_NT x64 10.0.19043
Sandboxed: No
fabiospampinato commented 1 year ago

Maybe it will work again if the extension will set these multiple times 🤔 I'll look into that.

fabiospampinato commented 1 year ago

It looks like there are no APIs for changing the icon or the color of a terminal after it has been created, so I guess this is just broken in vscode for now.

/cc @Tyriar if you'd like to take a look into this issue.

Tyriar commented 1 year ago

@fabiospampinato do you mean you have an existing Terminal object and you want to change the icon and color? This would be a new API request.

fabiospampinato commented 1 year ago

@Tyriar Yes-ish, basically this extension is setting the icon and the color when creating each terminal, and it was working fine in the past, but since some recent release apparently it stopped working, and people are suggesting it's because some new setting is interfering with that, basically overriding what the extension is doing.

So in some sense we don't really need new APIs, those settings that interfere should just be implemented in a way that they don't do anything if the terminal has already a custom icon/color set, which seems probably what should happen.

If that's not implementable or if it's undesirable for some reason then the only way to restore that functionality for this extension seems to be able to override icon and color again via some new API.

Tyriar commented 1 year ago

basically this extension is setting the icon and the color when creating each terminal, and it was working fine in the past, but since some recent release apparently it stopped working

Can you point to where it's getting set? It you create the terminal it should work, if you are trying to set Terminal.creationOptions it should not.

fabiospampinato commented 1 year ago

@Tyriar icon and color are being passed to createTerminal here: https://github.com/fabiospampinato/vscode-terminals/blob/dbc7080f9c619e323e36f4487ceca5dce4fd068b/src/run.ts#L113

Tyriar commented 1 year ago

Thanks, let's track in https://github.com/microsoft/vscode/issues/167643

tiageta commented 1 year ago

As a temporary fix, I got it to work by manually assigning the shellPath, even if it is my default one. I've only tested in Windows, though.

"shellPath": "C:\\Program Files\\PowerShell\\7\\pwsh.exe"
StoryDevOffical commented 1 year ago

On windows, there is no problem anymore on my side, but on MAC the problem still is.

vikingprank commented 1 year ago

As a temporary fix, I got it to work by manually assigning the shellPath, even if it is my default one. I've only tested in Windows, though.

"shellPath": "C:\\Program Files\\PowerShell\\7\\pwsh.exe"

Worked for me too, but only fixed the icon but not the color:

"shellPath": "C:\\Program Files\\Git\\bin\\bash.exe" EDIT: fixed the color too, when applied to each terminal setting

sullivan-ben commented 1 year ago

Can confirm adding shellPath fixes the icons on wsl2/ubuntu too.

My terminals.json:

{
    "autorun": true,
    "autokill": true,
    "terminals": [
        {
            "name": "Server",
            "shellPath": "/usr/bin/zsh",
            "icon": "cloud",
            "open": true,
            "focus": true,
            "commands": [
                "cd /home/my-username/projects/my-project/server",
                "npm run start:debug"
            ]
        },
        {
            "name": "Client",
            "shellPath": "/usr/bin/zsh",
            "icon": "browser",
            "open": true,
            "focus": false,
            "commands": [
                "cd /home/my-username/projects/my-project/client",
                "npm start"
            ]
        }
    ]
}
eduardohilariodev commented 1 year ago

As a temporary fix, I got it to work by manually assigning the shellPath, even if it is my default one. I've only tested in Windows, though.

"shellPath": "C:\\Program Files\\PowerShell\\7\\pwsh.exe"

Worked for me too, but only fixed the icon but not the color:

"shellPath": "C:\\Program Files\\Git\\bin\\bash.exe" EDIT: fixed the color too, when applied to each terminal setting

This did it for me. Thanks!

icodeyou commented 1 year ago

Thank you for this workaround ! Working on my mac with the following code:

{
      "name": "my terminal",
      "icon": "watch",
      "color": "terminal.ansiCyan",
      "shellPath": "/bin/zsh",
}