Terminal: Bug Report: `defaultProfile` in `profiles.json` is ignored

Created on 25 Sep 2019  路  32Comments  路  Source: microsoft/terminal

Environment

Platform ServicePack Version      VersionString
-------- ----------- -------      -------------
 Win32NT             10.0.18980.0 Microsoft Windows NT 10.0.18980.0


Windows Terminal (Preview)
Version: 0.5.2661.0

Steps to reproduce

  1. Open profiles.json (e.g. via Ctrl+,)
  2. Change "defaultProfiles" to the GUID of something which is not Windows Powershell for example the much more reasonable Powershell Core
  3. Windows Powershell is still the default

(extra: If the Windows Powershell is hidden then the "Cannot find default profile warning is shown")

Expected behavior

Uses the specified profile as the default profile.

Actual behavior

Keeps using the default profile specified in the defaults.json

My profile.json:

// To view the default settings, hold "alt" while clicking on the "Settings" button.
// For documentation on these settings, see: https://aka.ms/terminal-documentation

{
  "$schema": "https://aka.ms/terminal-profiles-schema",

  "defaultProfile": "{574e775e-4f2a-5b96-ac1e-a2962a402336}",

  "profiles": [
    {
      "guid": "{574e775e-4f2a-5b96-ac1e-a2962a402336}",
      "hidden": false,
      "name": "PowerShell Core",
      "source": "Windows.Terminal.PowershellCore",
      "fontFace": "Fira Code",
      "fontSize": 10
    },
    {
      // Make changes here to the powershell.exe profile
      "guid": "{61c54bbd-c2c6-5271-96e7-009a87ff44bf}",
      "name": "Windows PowerShell",
      "commandline": "powershell.exe",
      "hidden": false,
      "fontFace": "Fira Code"
    },
    {
      // Make changes here to the cmd.exe profile
      "guid": "{0caa0dad-35be-5f56-a8ff-afceeeaa6101}",
      "name": "cmd",
      "commandline": "cmd.exe",
      "hidden": false,
      "fontFace": "Fira Code"
    },

    {
      "guid": "{b453ae62-4e3d-5e58-b989-0a998ec441b8}",
      "hidden": false,
      "name": "Azure Cloud Shell",
      "source": "Windows.Terminal.Azure",
      "fontFace": "Fira Code"
    }
  ],

  // Add custom color schemes to this array
  "schemes": [],

  // Add any keybinding overrides to this array.
  // To unbind a default keybinding, set the command to "unbound"
  "keybindings": [],

  "globals": {
    "requestedTheme": "system",
    "copyOnSelect": true
  }
}

Area-Settings Product-Terminal Resolution-Duplicate

Most helpful comment

Actually just moving defaultProfile into the globals section solves it. It just seems that the default generated config has a top-level defaultProfile key which is ignored.

All 32 comments

ah this is the mysterious globals object problem.

If you remove the "globals" object, and just add those keys to the root of the json object, does it work?

@DHowett-MSFT There's a dupe for this somewhere, right? Should we just layer the globals sub-object if we find that too?

Actually just moving defaultProfile into the globals section solves it. It just seems that the default generated config has a top-level defaultProfile key which is ignored.

It鈥檚 only ignored if you create a globals key. We should fix that.

/dup #2906

Hi! We've identified this issue as a duplicate of another one that already exists on this Issue Tracker. This specific instance is being closed in favor of tracking the concern over on the referenced thread. Thanks for your report!

I'm seeing a weird derivation of this - @DHowett let me know if you'd like me to open another issue.

I'm on Version: 0.7.3291.0. The default profile is Powershell (61c54bbd..). If I set the default to PowershellCore (574e775e..) nothing happens, and new instances/tabs are Powershell. If I set the default to cmd.exe (0caa0dad..) or Ubuntu (2c4de342..), that works properly. It's just confusion between Powershell and PowershellCore.

This build doesn't seem to have this globals object at all.

@billwert that's very unusual... and you do have the version of PowerShell Core that is specified in your profile? The one thing I can think of is that it disappeared and the dynamic detector dropped it from the list... but if you can launch it just fine, that's definitely not it.

@DHowett-MSFT Sorry - just getting back from the holiday. Now I can't replicate what I was getting the other day, which is good. Maybe I was screwing things up copying and pasting the other day. Now I'm hitting #2300 and am excited for it to get fixed. :)

i do not have a globals object in my profiles.json but i am also unable to use it. I've commented everything out except the ubuntu object and it still displays all of them and defaults to powershell.
can someone please clarify exactly where the object should reside as ive tried having it in appdata/local/packages/windowsterminal_432452352351/roamingstate/profiles.json and appdata/local/packages/windowsterminal_224231512535/localstate/profiles.json both are ignored (btw the packagename i just made up the garbage past the underscore but they are as shipped)

no comment i guess cos everyone on holiday :) any help appreciated, all my seettings appear to be ignored regardless of what i do

None of us can really figure out what's up with your installation. I'm sorry.

Can you share the profiles.json in LocalState that you're talking about?

// To view the default settings, hold "alt" while clicking on the "Settings" button.
// For documentation on these settings, see: https://aka.ms/terminal-documentation

{
    "$schema": "https://aka.ms/terminal-profiles-schema",


    "defaultProfile": "{c6eaf9f4-32a7-5fdc-b5cf-066e8a4b1e40}",

    "profiles":
    [
        {
            // Make changes here to the powershell.exe profile         
            "guid": "{c6eaf9f4-32a7-5fdc-b5cf-066e8a4b1e40}",
            "hidden": false,
            "name": "Ubuntu-18.04",
            "source": "Windows.Terminal.Wsl",


        },

    ],

    // Add custom color schemes to this array
    "schemes": [

            ],

    // Add any keybinding overrides to this array.
    // To unbind a default keybinding, set the command to "unbound"
    "keybindings": []
}

and yet all the terminal options are displayed and the default is powershell every time . ive tried every iteration from commening out using // to outright removing as above. somehwere somehow something is superceeding but i dont know how it can. i suppose i could try deleting everything and resintalling the termianl from scratch again :(

I'm surprised it doesn't start up and display an error like this:

image

because on line 17 you have a key/value pair with a , at the end, and nothing after it... which is invalid json.

If you've stripped out anything from your profile, you have probably made it impossible to diagnose your issue.

yeah, thats the confusing thing, ive got increasingly desperate to the point where ive been intentionally introducing errors to prove its not using the file. its not using the file :(
its getting it from somewhere else and i dont know how. ill try completely deleting everytign and installing it again. but i cant help but suspect that whatever weird environment variable its picking up to cause it to compeltey ignore /local/ and /roaming/ will continue to have the same effect on the reinstalled version. I guess one thing i could ask is if someone could detail every location that the application can inheret from? or is that to vast a request? :)

There are only two locations the application will read settings from.

local

%LOCALAPPDATA%\Packages\Microsoft.WindowsTerminal_8wekyb3d8bbwe\LocalState\profiles.json

If this file exists, _no other files will be used._

roaming

%LOCALAPPDATA%\Packages\Microsoft.WindowsTerminal_8wekyb3d8bbwe\RoamingState\profiles.json

This file is only used if the local one does not exist.
When it is used, it is deleted and moved to LocalState.
RoamingState is where very old (v0.2) versions of Terminal used to save their data.

ok, thanks for confirmign that, im doing a complete removal of the application, and ill try reisntalling it clean and see what happens.

It does not support any environment variables, registry changes, or other configuration options that will change the location of the settings file.

If you have a very old (< v0.2) version of Terminal installed that you compiled from this repository, it will read settings from %LOCALAPPDATA%\Packages\Microsoft.WindowsTerminal_8wekyb3d8bbwe\RoamingState\profiles.json.

If you have the version of Windows Terminal distributed by onovotny or anybody else who published a version in May 2018, you are _severely_ out of date.

If you have built and installed terminal locally after v0.2, your package name will be different (WindowsTerminalDev_xxxxxxx).

If you are using our store-distributed version, the only file it reads is %LOCALAPPDATA%\Packages\Microsoft.WindowsTerminal_8wekyb3d8bbwe\LocalState\profiles.json. :smile:

going with store distributed version, complete reinstall, from factory setup, loading the profile and altering "default" as below

// To view the default settings, hold "alt" while clicking on the "Settings" button.
// For documentation on these settings, see: https://aka.ms/terminal-documentation

{
    "$schema": "https://aka.ms/terminal-profiles-schema",

    "defaultProfile": "{c6eaf9f4-32a7-5fdc-b5cf-066e8a4b1e40}",

    "profiles":
    [
        {
            // Make changes here to the powershell.exe profile
            "guid": "{61c54bbd-c2c6-5271-96e7-009a87ff44bf}",
            "name": "Windows PowerShell",
            "commandline": "powershell.exe",
            "hidden": false
        },
        {
            // Make changes here to the cmd.exe profile
            "guid": "{0caa0dad-35be-5f56-a8ff-afceeeaa6101}",
            "name": "cmd",
            "commandline": "cmd.exe",
            "hidden": false
        },
        {
            "guid": "{c6eaf9f4-32a7-5fdc-b5cf-066e8a4b1e40}",
            "hidden": false,
            "name": "Ubuntu-18.04",
            "source": "Windows.Terminal.Wsl"
        },
        {
            "guid": "{b453ae62-4e3d-5e58-b989-0a998ec441b8}",
            "hidden": false,
            "name": "Azure Cloud Shell",
            "source": "Windows.Terminal.Azure"
        }
    ],

    // Add custom color schemes to this array
    "schemes": [],

    // Add any keybinding overrides to this array.
    // To unbind a default keybinding, set the command to "unbound"
    "keybindings": []
}

does not result in ubuntu opening as default. it opens powershell lol :(

for ref that file is %LOCALAPPDATA%\Packages\Microsoft.WindowsTerminal_8wekyb3d8bbweLocalStateprofiles.json

That file should not be in RoamingState. It will be ignored if there is one in LocalState.

yeah sorry, i updated my comment to reflect, that was copy paste buffer from previous experiment, im working with LocalState as per the file oppened by the settings menu and as referenced by you previously . sorry about that

Fascinating. And if you set the defaultProfile to the GUID from cmd it's also ignored?

image

image

image

In addition, would you mind sending a screenshot of the About page from inside Terminal? This is very weird.

resorting to screenshots to give certainty for you :)

as i understand it, i have set the default profile to load the windows subsytem for linux, but it loads powershell every time.

i could try setting it to load cmd instead?

image

ok what the actual..... so i changed it to use the cmd guid, and it worked, and then changed it to use the wsl guid, and that worked too.

how in the holy heck lol

WELLP I GUESS THAT'S IT THEN

i seriously have no idea :smile:

so changing from powershell default to wsl default guid is ignored and continues to use powershell and ignores all setting. changing it to cmd first, then it starts listnening. lol shurg hey if my problems solved im a happy camper hahahahah! now to try doing my fancy translucency and wallpaper :D thanks for your help! sometimes its nice to just know that im not going in circles, having someone confirm that it wasnt inheriting from elsewhere was very helpful. random af hahaha thanks a lot!

Please look at #5458

Was this page helpful?
0 / 5 - 0 ratings

Related issues

dev-logan picture dev-logan  路  3Comments

mrmlnc picture mrmlnc  路  3Comments

alabuzhev picture alabuzhev  路  3Comments

waf picture waf  路  3Comments

wkbrd picture wkbrd  路  3Comments