2

I am attempting to use startupActions to launch a second tab when Windows Terminal launches with no luck.

My default shell is WSL, so I have the following in my settings.json:

  "startupActions": "; new-tab -p PowerShell",

I've tried it without the semi-colon and without the -p flag as well.

Here is the settings.json minus the color schemes:

 {
    "$help": "https://aka.ms/terminal-documentation",
    "$schema": "https://aka.ms/terminal-profiles-schema",
    "actions":
    [
        {
            "command":
            {
                "action": "copy",
                "singleLine": false
            },
            "keys": "ctrl+c"
        },
        {
            "command": "paste",
            "keys": "ctrl+v"
        },
        {
            "command": "find",
            "keys": "ctrl+shift+f"
        },
        {
            "command":
            {
                "action": "splitPane",
                "split": "auto",
                "splitMode": "duplicate"
            },
            "keys": "alt+shift+d"
        }
    ],
    "centerOnLaunch": true,
    "copyFormatting": "none",
    "copyOnSelect": false,
    "defaultProfile": "{2c4de342-38b7-51cf-b940-2309a097f518}",
    "initialCols": 98,
    "initialRows": 24,
    "showTerminalTitleInTitlebar": false,
    "startupActions": "; new-tab -p PowerShell",
    "useAcrylicInTabRow": true,
    "profiles":
    {
        "defaults":
        {
            "colorScheme": "Dracula",
            "cursorShape": "filledBox",
            "elevate": true,
            "font":
            {
                "face": "MesloLGS NF",
                "size": 12
            },
            "startingDirectory": null
        },
        "list":
        [
            {
                "antialiasingMode": "cleartype",
                "experimental.retroTerminalEffect": false,
                "guid": "{0caa0dad-35be-5f56-a8ff-afceeeaa6101}",
                "hidden": false,
                "name": "Command Prompt",
                "opacity": 75,
                "useAcrylic": true
            },
            {
                "guid": "{b453ae62-4e3d-5e58-b989-0a998ec441b8}",
                "hidden": true,
                "name": "Azure Cloud Shell",
                "opacity": 75,
                "source": "Windows.Terminal.Azure",
                "useAcrylic": true
            },
            {
                "antialiasingMode": "cleartype",
                "experimental.retroTerminalEffect": false,
                "font":
                {
                    "size": 12
                },
                "guid": "{2c4de342-38b7-51cf-b940-2309a097f518}",
                "hidden": false,
                "name": "Ubuntu",
                "opacity": 75,
                "scrollbarState": "visible",
                "source": "Windows.Terminal.Wsl",
                "startingDirectory": "\\\\wsl$\\Ubuntu\\home\\steve",
                "suppressApplicationTitle": true,
                "tabColor": "#BD93F9",
                "tabTitle": "Ubuntu 20.04",
                "useAcrylic": true
            },
            {
                "antialiasingMode": "cleartype",
                "experimental.retroTerminalEffect": false,
                "font":
                {
                    "face": "Fira Code Retina"
                },
                "guid": "{574e775e-4f2a-5b96-ac1e-a2962a402336}",
                "hidden": false,
                "name": "PowerShell",
                "opacity": 75,
                "source": "Windows.Terminal.PowershellCore",
                "tabColor": "#6272A4",
                "useAcrylic": true
            }
        ]
    }
}
Stephan
  • 345
  • 2
  • 14

1 Answers1

1

"elevate": true is your culprit here. You can't have mixed-elevation of tabs in the same window. Admin and non-admin windows need to stay separate. So when you launch those startupActions, the Terminal automatically creates a new admin window to host the powershell tab (which you've set to always run as admin).

Removing that setting from your powershell profile should work.

zadjii
  • 529
  • 2
  • 4
  • So the only way I was able to get it to work was by removing `"elevate": true` from each one. Is that the only way this will work? If they are all elevated then there isn't a mix, but that isn't working for me. I tried adding the elevate property to each terminal setting and also just in the defaults section. – Stephan Oct 14 '22 at 22:49
  • I updated my post with the full settings.json – Stephan Oct 14 '22 at 22:57