Ubuntu/WSL 从 Windows 终端中消失了?

Ubuntu/WSL 从 Windows 终端中消失了?

我在 Windows 终端上使用 WSL/Ubuntu 20.04,我想更改字体颜色。当我将设置复制到我的settings.json文件中时,Ubuntu 配置文件从 Windows 终端中消失了。

我的settings.json文件如下所示:

{
        "$help": "https://aka.ms/terminal-documentation",
        "$schema": "https://aka.ms/terminal-profiles-schema",
        "actions": [],
        "alwaysShowNotificationIcon": false,
        "defaultProfile": "{07b52e3e-de2c-5db4-bd2d-ba144ed6c273}",
        "firstWindowPreference": "defaultProfile",
        "profiles": 
        {
            "defaults": 
            {
                "colorScheme": "xcad_tdl",
                "font": 
                {
                    "face": "Consolas",
                    "size": 11
                },
                "historySize": 12000,
                "opacity": 95,
                "scrollbarState": "visible",
                "useAcrylic": false
            },
            "list": 
            [
                {
                    "guid": "{07b52e3e-de2c-5db4-bd2d-ba144ed6c273}",
                    "hidden": false,
                    "icon": "%userprofile%\\WindowsTerminalIcons\\ubuntu.png",
                    "name": "Ubuntu Linux",
                    "source": "Windows.Terminal.Wsl",
                    "startingDirectory": "\\\\wsl$\\Ubuntu-20.04\\home\\xcad"
                },
                {
                    "backgroundImage": "desktopWallpaper",
                    "font": 
                    {
                        "face": "Consolas"
                    },
                    "guid": "{0caa0dad-35be-5f56-a8ff-afceeeaa6101}",
                    "icon": "%userprofile%\\WindowsTerminalIcons\\cmd.png",
                    "name": "Commandline"
                },
                {
                    "guid": "{b453ae62-4e3d-5e58-b989-0a998ec441b8}",
                    "hidden": true,
                    "icon": "%userprofile%\\WindowsTerminalIcons\\azure.png",
                    "name": "Azure Cloud Shell",
                    "source": "Windows.Terminal.Azure"
                }
            ]
        },
         "schemes": 

    
        [
        {
            "name": "Campbell",
            "foreground": "#A7B191", 
            "background": "#0C0C0C",
            "colors": [
                "#0C0C0C",
                "#C50F1F",
                "#13A10E",
                "#C19C00",
                "#0037DA",
                "#881798",
                "#3A96DD",
                "#CCCCCC",
                "#767676",
                "#E74856",
                "#16C60C",
                "#F9F1A5",
                "#3B78FF",
                "#B4009E",
                "#61D6D6",
                "#F2F2F2"
            ]
        },
        {
            "background": "#012456",
            "black": "#0C0C0C",
            "blue": "#0037DA",
            "brightBlack": "#767676",
            "brightBlue": "#3B78FF",
            "brightCyan": "#61D6D6",
            "brightGreen": "#16C60C",
            "brightPurple": "#B4009E",
            "brightRed": "#E74856",
            "brightWhite": "#F2F2F2",
            "brightYellow": "#F9F1A5",
            "cursorColor": "#FFFFFF",
            "cyan": "#3A96DD",
            "foreground": "#CCCCCC",
            "green": "#13A10E",
            "name": "Campbell Powershell",
            "purple": "#881798",
            "red": "#C50F1F",
            "selectionBackground": "#FFFFFF",
            "white": "#CCCCCC",
            "yellow": "#C19C00"
        },
        {
            "background": "#282C34",
            "black": "#282C34",
            "blue": "#61AFEF",
            "brightBlack": "#5A6374",
            "brightBlue": "#61AFEF",
            "brightCyan": "#56B6C2",
            "brightGreen": "#98C379",
            "brightPurple": "#C678DD",
            "brightRed": "#E06C75",
            "brightWhite": "#DCDFE4",
            "brightYellow": "#E5C07B",
            "cursorColor": "#FFFFFF",
            "cyan": "#56B6C2",
            "foreground": "#DCDFE4",
            "green": "#98C379",
            "name": "One Half Dark",
            "purple": "#C678DD",
            "red": "#E06C75",
            "selectionBackground": "#FFFFFF",
            "white": "#DCDFE4",
            "yellow": "#E5C07B"
        },
        {
            "background": "#FAFAFA",
            "black": "#383A42",
            "blue": "#0184BC",
            "brightBlack": "#4F525D",
            "brightBlue": "#61AFEF",
            "brightCyan": "#56B5C1",
            "brightGreen": "#98C379",
            "brightPurple": "#C577DD",
            "brightRed": "#DF6C75",
            "brightWhite": "#FFFFFF",
            "brightYellow": "#E4C07A",
            "cursorColor": "#4F525D",
            "cyan": "#0997B3",
            "foreground": "#383A42",
            "green": "#50A14F",
            "name": "One Half Light",
            "purple": "#A626A4",
            "red": "#E45649",
            "selectionBackground": "#FFFFFF",
            "white": "#FAFAFA",
            "yellow": "#C18301"
        },
        {
            "background": "#002B36",
            "black": "#002B36",
            "blue": "#268BD2",
            "brightBlack": "#073642",
            "brightBlue": "#839496",
            "brightCyan": "#93A1A1",
            "brightGreen": "#586E75",
            "brightPurple": "#6C71C4",
            "brightRed": "#CB4B16",
            "brightWhite": "#FDF6E3",
            "brightYellow": "#657B83",
            "cursorColor": "#FFFFFF",
            "cyan": "#2AA198",
            "foreground": "#839496",
            "green": "#859900",
            "name": "Solarized Dark",
            "purple": "#D33682",
            "red": "#DC322F",
            "selectionBackground": "#FFFFFF",
            "white": "#EEE8D5",
            "yellow": "#B58900"
        },
        {
            "background": "#FDF6E3",
            "black": "#002B36",
            "blue": "#268BD2",
            "brightBlack": "#073642",
            "brightBlue": "#839496",
            "brightCyan": "#93A1A1",
            "brightGreen": "#586E75",
            "brightPurple": "#6C71C4",
            "brightRed": "#CB4B16",
            "brightWhite": "#FDF6E3",
            "brightYellow": "#657B83",
            "cursorColor": "#002B36",
            "cyan": "#2AA198",
            "foreground": "#657B83",
            "green": "#859900",
            "name": "Solarized Light",
            "purple": "#D33682",
            "red": "#DC322F",
            "selectionBackground": "#FFFFFF",
            "white": "#EEE8D5",
            "yellow": "#B58900"
        },
        {
            "background": "#000000",
            "black": "#000000",
            "blue": "#3465A4",
            "brightBlack": "#555753",
            "brightBlue": "#729FCF",
            "brightCyan": "#34E2E2",
            "brightGreen": "#8AE234",
            "brightPurple": "#AD7FA8",
            "brightRed": "#EF2929",
            "brightWhite": "#EEEEEC",
            "brightYellow": "#FCE94F",
            "cursorColor": "#FFFFFF",
            "cyan": "#06989A",
            "foreground": "#D3D7CF",
            "green": "#4E9A06",
            "name": "Tango Dark",
            "purple": "#75507B",
            "red": "#CC0000",
            "selectionBackground": "#FFFFFF",
            "white": "#D3D7CF",
            "yellow": "#C4A000"
        },
        {
            "background": "#FFFFFF",
            "black": "#000000",
            "blue": "#3465A4",
            "brightBlack": "#555753",
            "brightBlue": "#729FCF",
            "brightCyan": "#34E2E2",
            "brightGreen": "#8AE234",
            "brightPurple": "#AD7FA8",
            "brightRed": "#EF2929",
            "brightWhite": "#EEEEEC",
            "brightYellow": "#FCE94F",
            "cursorColor": "#000000",
            "cyan": "#06989A",
            "foreground": "#555753",
            "green": "#4E9A06",
            "name": "Tango Light",
            "purple": "#75507B",
            "red": "#CC0000",
            "selectionBackground": "#FFFFFF",
            "white": "#D3D7CF",
            "yellow": "#C4A000"
        },
        {
            "background": "#000000",
            "black": "#000000",
            "blue": "#000080",
            "brightBlack": "#808080",
            "brightBlue": "#0000FF",
            "brightCyan": "#00FFFF",
            "brightGreen": "#00FF00",
            "brightPurple": "#FF00FF",
            "brightRed": "#FF0000",
            "brightWhite": "#FFFFFF",
            "brightYellow": "#FFFF00",
            "cursorColor": "#FFFFFF",
            "cyan": "#008080",
            "foreground": "#C0C0C0",
            "green": "#008000",
            "name": "Vintage",
            "purple": "#800080",
            "red": "#800000",
            "selectionBackground": "#FFFFFF",
            "white": "#C0C0C0",
            "yellow": "#808000"
        },
        {
            "background": "#111927",
            "black": "#000000",
            "blue": "#004CFF",
            "brightBlack": "#666666",
            "brightBlue": "#5CB2FF",
            "brightCyan": "#5CECC6",
            "brightGreen": "#C5F467",
            "brightPurple": "#AE81FF",
            "brightRed": "#FF8484",
            "brightWhite": "#FFFFFF",
            "brightYellow": "#FFCC5C",
            "cursorColor": "#FFFFFF",
            "cyan": "#2EE7B6",
            "foreground": "#D4D4D4",
            "green": "#9FEF00",
            "name": "xcad_hackthebox",
            "purple": "#BC3FBC",
            "red": "#FF3E3E",
            "selectionBackground": "#FFFFFF",
            "white": "#FFFFFF",
            "yellow": "#FFAF00"
        },
        {
            "background": "#1A1A1A",
            "black": "#121212",
            "blue": "#2B4FFF",
            "brightBlack": "#2F2F2F",
            "brightBlue": "#5C78FF",
            "brightCyan": "#5AC8FF",
            "brightGreen": "#905AFF",
            "brightPurple": "#5EA2FF",
            "brightRed": "#BA5AFF",
            "brightWhite": "#FFFFFF",
            "brightYellow": "#685AFF",
            "cursorColor": "#FFFFFF",
            "cyan": "#28B9FF",
            "foreground": "#F1F1F1",
            "green": "#7129FF",
            "name": "xcad_tdl",
            "purple": "#2883FF",
            "red": "#A52AFF",
            "selectionBackground": "#FFFFFF",
            "white": "#F1F1F1",
            "yellow": "#3D2AFF"
        },
        {
            "background": "#0F0F0F",
            "black": "#000000",
            "blue": "#2878FF",
            "brightBlack": "#2F2F2F",
            "brightBlue": "#5E99FF",
            "brightCyan": "#5AD6FF",
            "brightGreen": "#FFB15A",
            "brightPurple": "#935CFF",
            "brightRed": "#FF755A",
            "brightWhite": "#FFFFFF",
            "brightYellow": "#FFD25A",
            "cursorColor": "#FFFFFF",
            "cyan": "#28C8FF",
            "foreground": "#F1F1F1",
            "green": "#FF9A28",
            "name": "xcad_tdl_colorful",
            "purple": "#732BFF",
            "red": "#FF4C27",
            "selectionBackground": "#FFFFFF",
            "white": "#F1F1F1",
            "yellow": "#FFC72A"
        },
        {
            "background": "#0F0F0F",
            "black": "#000000",
            "blue": "#184AE8",
            "brightBlack": "#5F5F5F",
            "brightBlue": "#4771F5",
            "brightCyan": "#31C1FF",
            "brightGreen": "#FFD631",
            "brightPurple": "#7631FF",
            "brightRed": "#FF3190",
            "brightWhite": "#FFFFFF",
            "brightYellow": "#FF9731",
            "cursorColor": "#FFFFFF",
            "cyan": "#008DCB",
            "foreground": "#D9D9D9",
            "green": "#CBA300",
            "name": "xcad_tdl_old",
            "purple": "#4300CB",
            "red": "#CB005F",
            "selectionBackground": "#FFFFFF",
            "white": "#CFCFCF",
            "yellow": "#CB6600"
        },
        {
            "background": "#282C34",
            "black": "#000000",
            "blue": "#007ACC",
            "brightBlack": "#75715E",
            "brightBlue": "#11A8CD",
            "brightCyan": "#11A8CD",
            "brightGreen": "#0DBC79",
            "brightPurple": "#AE81FF",
            "brightRed": "#DD6B65",
            "brightWhite": "#F8F8F2",
            "brightYellow": "#E6DB74",
            "cursorColor": "#FFFFFF",
            "cyan": "#11A8CD",
            "foreground": "#D4D4D4",
            "green": "#0DBC79",
            "name": "xcad_vscode",
            "purple": "#BC3FBC",
            "red": "#F4423A",
            "selectionBackground": "#FFFFFF",
            "white": "#F8F8F2",
            "yellow": "#E5E510"
        }
    ],
    "showTabsInTitlebar": true,
    "tabSwitcherMode": "inOrder",
    "theme": "system",
    "useAcrylicInTabRow": true
}

当我单击设置时,它发出警告:

[{
    "resource": "/C:/Users/janlu/AppData/Local/Packages/Microsoft.WindowsTerminal_8wekyb3d8bbwe/LocalState/settings.json",
    "owner": "_generated_diagnostic_collection_name_#0",
    "code": "768",
    "severity": 4,
    "message": "Draft 2020-12 schemas are not yet fully supported.",
    "startLineNumber": 1,
    "startColumn": 1,
    "endLineNumber": 1,
    "endColumn": 2
}]

而且,当我启动 Windows 终端时,它说......

Settings could not be loaded from file. Check for syntax errors, including trailing commas.
* Line 2, Column 5
  Missing '}' or object member name

Temporarily using the Windows Terminal default settings.

您知道如何才能让我的 WSL 再次工作但使用新的字体颜色吗?

我想让它看起来更像这些设置但带有我的电脑的背景图像。

编辑:根据评论添加屏幕截图:

可能的字节标记??

答案1

您的问题settings.json似乎可以验证,所以我可能会怀疑@DavidPostill 在评论中指出的内容。我会尝试:

  • 删除现有的settings.json并让终端重新生成它。

  • Ubuntu应该当它扫描要创建的配置文件列表时返回。至少我希望您不会再收到错误消息。

  • 或者——从此处复制您的问题中的设置并将其粘贴回新生成的配置。如果您再次收到错误,则说明配置中存在我们未看到的内容。继续下一步(或直接开始下一步)。

  • 如今,您很少需要手动编辑settings.json。您关注的网站可能有点过时,因为 Windows Terminal 现在有一个图形界面,可以修改大多数设置(包括主题/颜色)。如果 Terminal 重新生成了 ok settings.json,那么您可以尝试直接在设置菜单。如果您需要精确的数字代码,则可以修改只是手动执行该方案settings.json

希望这将帮助您恢复您的设置(和 Ubuntu/WSL 配置文件)。

相关内容