功能

微软 Windows Terminal 已经正式发布!Windows Terminal 顾名思义就是「Windows 终端」,是一款全新的,现代的快速、高效且功能强大的终端应用程序。它同时适用于会用到:「命令提示符」、PowerShell和 WSL等命令行交互的用户

多标签支持

「终端」用户最常见的需求就是多标签支持。所以,应广大用户的需求,Windows Terminal 工具也提供了多标签支持。用户可以在交互窗口中打开多个选项卡,不同的选项卡会连接到用户选择的命令行 Shell 或应用程序,例如:「命令提示符」、PowerShell 或者 WSL 上的 Ubuntu,甚至通过 SSH 连接到 Raspberry Pi 等。

优化的字体

Windows Terminal 使用了基于 GPU 加速的 DirectWrite/DirectX 文本呈现引擎,这个新的文本渲染引擎将用于显示 PC 字体中存在的文本字符、字形和符号,包括:CJK 表意文字、表情符号、电力线符号、图标、编程连字等。与此同时,该引擎还能够比以前控制台的 GDI 引擎更快地呈现文本。

设置和可配置性

Windows Terminal 提供了许多设置和配置选项,您可以对终端的外观以及不同选项卡打开的 Shell 和配置文件进行大量控制。而且不同的配置和设置是存储在结构化文本文件中的,以便用户或其它工具进行调用。

安装

安装非常简单,直接在win10的商店搜索Windows Terminal安装就行了
Windows Terminal

开始美化

现在开始美化吧,点设置后,会自动打开一个配置文件,就像Vscode一样,是用json配置的,小白劝退,直接无脑复制粘贴,首先值得我们关注的是,就是配置文件的第一行https://aka.ms/terminal-profiles-schema,XML文件一般都有个schema,用于说明这个XML怎么写,有什么规则,这个配置文件也有一个,也是一样的作用啦。有了这个schema文件,我们就能知道这个配置文件怎么写了。打开后是一个很长很长的json文本。
终端设置
大概结构globals是全局设置,profiles是各个不同的shell的配置,schemes是配色的方案, ms-appx:///xxx指的是应用程序包的xxx文件,在我电脑上对应的路径是C:\Program Files\.......这里只是写下最基础的修改,我的要求不高,哈哈,能看就可以了,网上还有很多美化教程,可以自己搜看看,这里就不一一描述了。
设置默认shell

Copy"defaultProfile": "{c6eaf9f4-32a7-5fdc-b5cf-066e8a4b1e40}"
将defaultProfile设置成profile的guid值即可,我设置为了wsl的guid

设置字体

Copy"fontFace": "DejaVu Sans Mono"

设置背景图

Copy   "acrylicOpacity": 0.5,
   "useAcrylic": true,
   "backgroundImage": "C:\\Users\\Kira Yoshikage\\Pictures\\wallhaven-36230.png",
   "backgroundImageOpacity": 0.75,
   "backgroundImageStretchMode": "fill"

其他

alwaysShowTabs    //始终显示标签
defaultProfile    //默认终端
initialCols    //默认列数
initialRows    //默认行数
keybindings    //快捷键配置
command    //快捷键执行的命令
keys    //快捷键
requestedTheme    //主题
showTabsInTitlebar    //在标题栏中显示终端窗口标签栏
showTerminalTitleInTitlebar    //在标签栏中显示终端标签
acrylicOpacity    //不透明度
closeOnExit    //退出后关闭
colorScheme    //颜色主题
commandline    //命令行程序
cursorColor    //光标颜色
cursorShape    //光标形状
fontFace    //字体
fontSize    //字体大小
guidy//Size    //历史大小
icon    //图标
name    //名称
padding    //填充
startingDirectory    //初始目录
useAcrylic    //使用不透明度

我的美化效果

效果图
效果图

配置

// This file was initially generated by Windows Terminal 1.1.2021.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",
                "hidden": false,
                "closeOnExit" : true,
                "cursorColor" : "#2ed41a",
                "fontSize" : 12,
                "padding" : "5, 5, 5, 5",
                "tabTitle" : "Command Prompt",
                "fontFace": "PxPlus IBM VGA8",
                "experimental.retroTerminalEffect": true
            },
            {
                "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 keybindings to this array.
    // To unbind a key combination from your defaults.json, set the command to "unbound".
    // To learn more about keybindings, visit https://aka.ms/terminal-keybindings
    "keybindings":
    [
        // 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" }
    ]
}

其他美化

// 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}",

    "profiles":
    {
        "defaults":/*全局配置*/
        {
            // Put settings here that you want to apply to all profiles
            // 默认打开的 Profile GUID(下面会详细介绍)
            "defaultProfile": "{0caa0dad-35be-5f56-a8ff-afceeeaa6101}",
            // 终端窗口默认大小
            "initialCols": 120,
            "initialRows": 30,
            // 亮色或暗色主题,可选值 "light", "dark", "system"
            "requestedTheme": "system",
            // 合并标题栏和标签栏
            "showTabsInTitlebar": true,
            // 如果 showTabsInTitlebar 与本值同为 false 时,自动隐藏标签栏
            "alwaysShowTabs": true,
            // 在标题栏上显示当前活动标签页的标题
            "showTerminalTitleInTitlebar": true,
            // 双击选择时用于分词的字符
            "wordDelimiters": " /\\()\"'-.,:;<>~!@#$%^&*|+=[]{}~?\u2502",
            // 选择时复制到剪贴板
            "copyOnSelect": true,
        
            // ...
        },
        "list":/*每种类型terminal的详细配置*/
        [
            {
                // Make changes here to the cmd.exe profile 关于cmd的配置
                "guid": "{0caa0dad-35be-5f56-a8ff-afceeeaa6101}",
                /*网页搜索guid生成可以获得每个程序唯一的guid,visual studio内的工具也有生成guid的功能*/
                "name": "cmd",
                "commandline": "cmd.exe",
                /*程序位置*/
                "hidden": false,
                
                "tabTitle" : "cmd",/*名称*/
                "foreground" : "#DCDCDC",/*字体颜色*/
                "icon" : "D:/KuroNekoNano_blog/themes/hexo-theme-matery/source/favicon.png",/*ICO图标*/
                "backgroundImage" : "D:/图片整理/3440x1440 (41).jpg",/*终端背景图*/
                "acrylicOpacity" : 0.75,
                /*亚克力透明效果*/
                "backgroundImageOpacity" : 0.25,
                /*背景透明度*/
                "backgroundImageStretchMode" : "fill",
                "closeOnExit" : true,
                "colorScheme" : "Campbell",
                "cursorColor" : "#FFFFFF",
                "cursorShape" : "bar",
                "fontFace" : "Consolas",
                "fontSize" : 11,
                "historySize" : 9001,
                "padding" : "0, 0, 0, 0",
                "snapOnInput" : true,
                "startingDirectory" : "%USERPROFILE%",
                "useAcrylic" : true
            },
            {
                // Make changes here to the Anaconda Prompt profile 关于anaconda的配置
                "guid": "{FCAD2812-51E4-4E55-96AF-2F2B75628FE0}",
                "name": "anaconda prompt",
                "commandline": "%windir%\\System32\\cmd.exe /K D:\\Users\\KuroNeko\\Anaconda3\\Scripts\\activate.bat",
                "hidden": false,
                
                "tabTitle" : "Anaconda Prompt",/*名称*/
                "foreground" : "#DCDCDC",/*字体颜色*/
                "icon" : "D:/Users/KuroNeko/Anaconda3/Menu/anaconda-navigator.ico",/*ICO图标*/
                "backgroundImage" : "D:/图片整理/3440x1440 (46).jpg",/*终端背景图*/
                "acrylicOpacity" : 0.75,
                "backgroundImageOpacity" : 0.25,
                "backgroundImageStretchMode" : "fill",
                "closeOnExit" : true,
                "colorScheme" : "Campbell",
                "cursorColor" : "#FFFFFF",
                "cursorShape" : "bar",
                "fontFace" : "Consolas",
                "fontSize" : 11,
                "historySize" : 9001,
                "padding" : "0, 0, 0, 0",
                "snapOnInput" : true,
                "startingDirectory" : "%USERPROFILE%",
                "useAcrylic" : true
            },
            {
                // Make changes here to the Git Bash profile  关于Git bash的配置
                "guid": "{4B25BFD9-4962-49AE-8512-BBD336462BAB}",
                "name": "Git Bash",
                "commandline": "D:\\Program Files (x86)\\Git\\bin\\bash.exe",
                "hidden": false,
                
                "tabTitle" : "Git Bash",/*名称*/
                "foreground" : "#DCDCDC",/*字体颜色*/
                "icon" : "D:/图片整理/2019-07-02-10-22-00.png",/*ICO图标*/
                "backgroundImage" : "D:/图片整理/Screenshot_20180615-013342.png",/*终端背景图*/
                "acrylicOpacity" : 0.75,
                "backgroundImageOpacity" : 0.25,
                "backgroundImageStretchMode" : "fill",
                "closeOnExit" : true,
                "colorScheme" : "Campbell",
                "cursorColor" : "#FFFFFF",
                "cursorShape" : "bar",
                "fontFace" : "Consolas",
                "fontSize" : 11,
                "historySize" : 9001,
                "padding" : "0, 0, 0, 0",
                "snapOnInput" : true,
                "startingDirectory" : "%USERPROFILE%",
                "useAcrylic" : true
            },
            {
                // Make changes here to the powershell.exe profile
                "guid": "{61c54bbd-c2c6-5271-96e7-009a87ff44bf}",
                "name": "Windows PowerShell",
                "commandline": "powershell.exe",
                "hidden": false,
                
                "tabTitle" : "PowerShell",
                "foreground" : "#DCDCDC",
                "icon" : "D:/图片整理/%23C[KC]AMNLO31Q~N{$UVS.png",
                "backgroundImage" : "D:/图片整理/3440x1440 (44).jpg",
                "acrylicOpacity" : 0.4,
                "backgroundImageOpacity" : 0.6,
                "backgroundImageStretchMode" : "fill",
                "colorScheme" : "Campbell",
                "cursorColor" : "#FFFFFF",
                "cursorShape" : "bar",
                "fontFace" : "Consolas",
                "fontSize" : 11,
                "historySize" : 9001,
                "padding" : "0, 0, 0, 0",
                "snapOnInput" : true,
                "startingDirectory" : "%USERPROFILE%",
                "useAcrylic" : true
            },
            {
                "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": []
}

配置项的功能说明:

"profiles":
[
    {
        // 每个 Profile 的唯一标识符,生成方法见下
        "guid": "{e1e1ac58-02c1-456a-a857-01149673a65d}",
        // 设置为 true 即可在新建菜单中隐藏
        "hidden": false,
        // 名字,会显示在菜单中
        "name": "Ubuntu",
        // 启动命令行
        "commandline": "wsl.exe",
        // 启动目录
        "startingDirectory": "%USERPROFILE%",

        // 字体设置
        "fontFace": "Consolas",
        "fontSize": 11,

        // 背景亚克力透明效果(窗口失去焦点时无效)
        "useAcrylic": true,
        "acrylicOpacity": 0.5,

        // 背景图片
        // "backgroundImage" : "X:\\assets\\background.png",
        // "backgroundImageOpacity" : 0.5,
        // "backgroundImageStretchMode" : "uniformToFill",

        // 菜单与标签中显示的图标
        "icon": "X:\\assets\\UbuntuLogo.scale-100.png",
        // 配色方案,见下
        "colorScheme": "Atom",
        // 光标颜色
        "cursorColor": "#FFFFFF",
        // 光标类型,可选值 "vintage" ( ▃ ), "bar" ( ┃ ), "underscore" ( ▁ ), "filledBox" ( █ ), "emptyBox" ( ▯ )
        "cursorShape": "underscore"

        // ... 其他配置请参见官方文档
    }
]

可选配色方案:


"schemes": [
    {
        "name": "Atom",
        "black": "#000000",
        "red": "#fd5ff1",
        "green": "#87c38a",
        "yellow": "#ffd7b1",
        "blue": "#85befd",
        "purple": "#b9b6fc",
        "cyan": "#85befd",
        "white": "#e0e0e0",
        "brightBlack": "#000000",
        "brightRed": "#fd5ff1",
        "brightGreen": "#94fa36",
        "brightYellow": "#f5ffa8",
        "brightBlue": "#96cbfe",
        "brightPurple": "#b9b6fc",
        "brightCyan": "#85befd",
        "brightWhite": "#e0e0e0",
        "background": "#161719",
        "foreground": "#c5c8c6"
    }
],
最后修改:2021 年 03 月 16 日 12 : 47 PM
如果觉得我的文章对你有用,请随意赞赏