Windows Terminal 修改字体大小
后知后觉 暂无评论

Windows 10 中可以安装新的终端程序,相比于简陋的 CMD ,不仅界面美观大方,且使用体验也很优秀。

I

在 2K 及以上分辨率的荧幕上显示得过小,因此需要修改字体大小,但是看了自带的设置发现竟然没有相关字段。建议安装 Visual Studio Code 来进行修改。

Settings

▲ 直接选择左下角的“打开 JSON 文件”即可以文本模式修改设置

默认参数无字体相关参数,需要手动添加重新指定即可。

settings.json

旧版配置

设置为 JSON 格式,如若修改字体大小,可在 profiles -> list -> powershell 标签内,增加 "fontSize": 13, 参数即可,如果加在最后一行,则无需结尾的逗号。

部分配置参考:

// This file was initially generated by Windows Terminal 1.4.3141.0
// It should still be usable in newer versions, but newer versions might have additional
// settings, help text, or changes that you will not see unless you clear this file
// and let us generate a new one for you.

// 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": "{61c54bbd-c2c6-5271-96e7-009a87ff44bf}",

    // You can add more global application settings here.
    // To learn more about global settings, visit https://aka.ms/terminal-global-settings

    // If enabled, selections are automatically copied to your clipboard.
    "copyOnSelect": false,

    // If enabled, formatted data is also copied to your clipboard
    "copyFormatting": false,

    // A profile specifies a command to execute paired with information about how it should look and feel.
    // Each one of them will appear in the 'New Tab' dropdown,
    //   and can be invoked from the commandline with `wt.exe -p xxx`
    // To learn more about profiles, visit https://aka.ms/terminal-profile-settings
    "profiles":
    {
        "defaults":
        {
            // Put settings here that you want to apply to all profiles.
        },
        "list":
        [
            {
                // Make changes here to the powershell.exe profile.
                "guid": "{61c54bbd-c2c6-5271-96e7-009a87ff44bf}",
                "name": "Windows PowerShell",
                "commandline": "powershell.exe",
                "fontFace": "Cascadia Mono",
                "fontWeight": "normal",
                "fontSize": 13,
                "hidden": false
            },
            {
                // Make changes here to the cmd.exe profile.
                "guid": "{0caa0dad-35be-5f56-a8ff-afceeeaa6101}",
                "name": "Command Prompt",
                "commandline": "cmd.exe",
                "hidden": false
            },
            {
                "guid": "{b453ae62-4e3d-5e58-b989-0a998ec441b8}",
                "hidden": false,
                "name": "Azure Cloud Shell",
                "source": "Windows.Terminal.Azure"
            }
        ]
    },

    // Add custom color schemes to this array.
    // To learn more about color schemes, visit https://aka.ms/terminal-color-schemes
    "schemes": [],

    // Add custom actions and keybindings to this array.
    // To unbind a key combination from your defaults.json, set the command to "unbound".
    // To learn more about actions and keybindings, visit https://aka.ms/terminal-keybindings
    "actions":
    [
        // Copy and paste are bound to Ctrl+Shift+C and Ctrl+Shift+V in your defaults.json.
        // These two lines additionally bind them to Ctrl+C and Ctrl+V.
        // To learn more about selection, visit https://aka.ms/terminal-selection
        { "command": {"action": "copy", "singleLine": false }, "keys": "ctrl+c" },
        { "command": "paste", "keys": "ctrl+v" },

        // Press Ctrl+Shift+F to open the search box
        { "command": "find", "keys": "ctrl+shift+f" },

        // Press Alt+Shift+D to open a new pane.
        // - "split": "auto" makes this pane open in the direction that provides the most surface area.
        // - "splitMode": "duplicate" makes the new pane use the focused pane's profile.
        // To learn more about panes, visit https://aka.ms/terminal-panes
        { "command": { "action": "splitPane", "split": "auto", "splitMode": "duplicate" }, "keys": "alt+shift+d" }
    ]
}

新版配置

最新版中 "fontSize" 参数已经废弃,需要使用 "font" 父项来进行指定。

    ...
    "profiles":
    {
        "defaults": {};
        "list":
        [
            {
                "guid": "{61c54bbd-c2c6-5271-96e7-009a87ff44bf}",
                "hidden": false,
                "name": "Windows PowerShell",
                "font": {
                    "size": 13
                }
            }, 
            ...
        ]
    }
    ...

除此之外还有 axes, face, weight, features 子参数可以指定。

II

自定义新建标签,如果在为已安装的 WSL 分发设置打开时的起始目录时,应使用以下格式:"startingDirectory": "//wsl$/",并用分发的名称进行替换。 例如:"startingDirectory": "//wsl$/Ubuntu-20.04"

下拉列表设置

▲ 效果如上图


附录

参考链接

本文撰写于一年前,如出现图片失效或有任何问题,请在下方留言。博主看到后将及时修正,谢谢!
禁用 / 当前已拒绝评论,仅可查看「历史评论」。