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

colorScheme not respected when Windows Terminal is restarted (depending on how it was previously closed) #18446

Closed
thernstig opened this issue Jan 21, 2025 · 2 comments
Labels
Issue-Bug It either shouldn't be doing this or needs an investigation. Needs-Attention The core contributors need to come back around and look at this ASAP. Needs-Triage It's a new issue that the core contributor team needs to triage at the next triage meeting

Comments

@thernstig
Copy link

Windows Terminal version

1.21.3231.0

Windows build number

10.0.26100.2894

Other Software

WSL: 2.3.26.0

Steps to reproduce

  1. Launch Windows Terminal
  2. Close the window on the top-right X button.
  3. Re-open Windows Terminal

Sometimes the color scheme selected is incorrect.

Expected Behavior

The selected color scheme to be correct.

Actual Behavior

I have the following settings.json:

{
    "$help": "https://aka.ms/terminal-documentation",
    "$schema": "https://aka.ms/terminal-profiles-schema",
    "actions": 
    [
        {
            "command": 
            {
                "action": "copy",
                "singleLine": false
            },
            "id": "User.copy.644BA8F2",
            "keys": "ctrl+c"
        },
        {
            "command": "paste",
            "id": "User.paste",
            "keys": "ctrl+v"
        },
        {
            "command": 
            {
                "action": "splitPane",
                "split": "auto",
                "splitMode": "duplicate"
            },
            "id": "User.splitPane.A6751878",
            "keys": "alt+shift+d"
        },
        {
            "command": "find",
            "id": "User.find",
            "keys": "ctrl+shift+f"
        }
    ],
    "copyFormatting": "none",
    "copyOnSelect": false,
    "defaultProfile": "{51855cb2-8cce-5362-8f54-464b92b32386}",
    "firstWindowPreference": "persistedWindowLayout",
    "launchMode": "maximized",
    "newTabMenu": 
    [
        {
            "type": "remainingProfiles"
        }
    ],
    "profiles": 
    {
        "defaults": 
        {
            "font": 
            {
                "size": 10
            },
            "historySize": 50000,
            "padding": "5, 5, 5, 5"
        },
        "list": 
        [
            {
                "commandline": "%SystemRoot%\\System32\\WindowsPowerShell\\v1.0\\powershell.exe",
                "guid": "{61c54bbd-c2c6-5271-96e7-009a87ff44bf}",
                "hidden": false,
                "name": "Windows PowerShell"
            },
            {
                "commandline": "%SystemRoot%\\System32\\cmd.exe",
                "guid": "{0caa0dad-35be-5f56-a8ff-afceeeaa6101}",
                "hidden": false,
                "name": "Command Prompt"
            },
            {
                "guid": "{2c4de342-38b7-51cf-b940-2309a097f518}",
                "hidden": true,
                "source": "Windows.Terminal.Wsl"
            },
            {
                "guid": "{b453ae62-4e3d-5e58-b989-0a998ec441b8}",
                "hidden": false,
                "name": "Azure Cloud Shell",
                "source": "Windows.Terminal.Azure"
            },
            {
                "colorScheme": "One Half Dark",
                "guid": "{51855cb2-8cce-5362-8f54-464b92b32386}",
                "hidden": false,
                "source": "CanonicalGroupLimited.Ubuntu_79rhkp1fndgsc"
            }
        ]
    },
    "schemes": [],
    "themes": []
}

First time I start Windows Terminal I see this:

Image

If I press the circled X on the tab, then reopen Windows Terminal, it uses the same One Half Dark.

If I press the X on the top-right and reopen Windows Terminal, it looks like this instead:

Image

Notice how it is not using One Half Dark anymore.

Since my default profile is set to {51855cb2-8cce-5362-8f54-464b92b32386} it should in both cases use One Half Dark, even if I have "firstWindowPreference": "persistedWindowLayout" set.

Possibly related

#16996
#11457

@thernstig thernstig added Issue-Bug It either shouldn't be doing this or needs an investigation. Needs-Triage It's a new issue that the core contributor team needs to triage at the next triage meeting labels Jan 21, 2025
@carlos-zamora
Copy link
Member

Thanks for filing! Can you share your state.json file (it should be next to your settings.json file) after you close Terminal (in the repro state) /?

@microsoft-github-policy-service microsoft-github-policy-service bot added the Needs-Author-Feedback The original author of the issue/PR needs to come back and respond to something label Jan 22, 2025
@thernstig
Copy link
Author

@carlos-zamora I cannot reproduce this now. I have a vague idea why it might have happened, but have no exact repro.

Notice in the last picture that the icon also changed. It indicates the "source": "Windows.Terminal.Wsl" profile was started when reopening Windows Terminal.

When I was doing these experiments, I was editing the settings.json file and saving the file. But at the same time, I had the settings GUI opened in Windows Terminal, where I most likely had done some changes but without pressing save.

I believe there is some problem in state.json here maybe and how all this is read, in what order, during startup or something. But as I cannot repro it there is not much more to go at.

So there might be some obscure, random, bug between settings.json and state.json (wild guess), but as I have not tangible to go by, I will close this.

@microsoft-github-policy-service microsoft-github-policy-service bot added Needs-Attention The core contributors need to come back around and look at this ASAP. and removed Needs-Author-Feedback The original author of the issue/PR needs to come back and respond to something labels Jan 23, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Issue-Bug It either shouldn't be doing this or needs an investigation. Needs-Attention The core contributors need to come back around and look at this ASAP. Needs-Triage It's a new issue that the core contributor team needs to triage at the next triage meeting
Projects
None yet
Development

No branches or pull requests

2 participants