Windows Terminal 0.3发布:一系列改进和错误修复

Posted

tags:

篇首语:本文由小常识网(cha138.com)小编为大家整理,主要介绍了Windows Terminal 0.3发布:一系列改进和错误修复相关的知识,希望对你有一定的参考价值。

参考技术A

微软正在推出多选项卡式 Windows Terminal v.0.3 控制台应用程序的预览版,提供了一系列改进和错误修复,包括拖动标题栏、自定义选项卡标题等功能。 Windows Terminal 是微软在 2019 年 5 月的 Build Developer 会议上宣布并于 6 月份推出的一款开源终端应用程序。

Windows Terminal 包含命令提示符和 PowerShell 的所有优点,其主要功能之一是能够打开多个选项卡,每个选项卡都支持自己的 shell。

在 Windows Terminal 中,可以运行 PowerShell、命令提示符和 Linux 终端(如 Ubuntu),只需一个点击就可以在它们之间切换。它还支持自定义主题、样式、Unicode 等。

可拖式标题栏

最新版本的 Windows Terminal 提供了一个改进的界面,可以从任何地方拖动,但是拖放区域仍然限制在右侧,当打开更多选项卡时,部分会变小。

改进下拉按钮布局

微软还改进了标题栏的外观,并重新绘制了下拉按钮。微软表示,下拉按钮现在保留在上一次打开的右边,以便更快地访问,并调整了按钮的大小。

更新终端后,可以在“最小化”、“最大化”和“关闭”按钮上注意到新的颜色。

可访问性

Windows Terminal 获得了一些可访问性功能,允许像 Narrator 这样的工具询问、导航和读取终端 UI 控件和文本内容的内容。这是通过将终端的控制和内容公开为 a(UIA) 而实现的,但改进后的可访问性体验仍处于开发的初始阶段,尚未在 Redmond 进行彻底的测试,因此使用起来可能会遇到 bug。

设置改进

微软添加对新配置选项的支持,用户可以利用这些选项来增强终端的性能和功能。

自定义选项卡标题

现在,通过在配置文件中设置“tabTitle”属性,用户可以为选项卡更换自己的自定义标题。要注意的是,修改此设置将覆盖配置文件的 shell 提供的选项卡标题。用户可以使用自定义选项卡标题功能来区分配置文件。

附加背景选项

现在,可以将背景图像添加到 WindowsTerminal 屏幕上,并且仍然可以使用带有颜色的 acrylic 背景。要启用此特性,必须使用以下属性:

"backgroundImage"、 "useAcrylic"和 "background"

还可以使用 “backoundImageAlignment” 键和 "center"、"left"、 "top"、 "right"、 "bottom"、 "topLeft"、 "topRight"、 "bottomLeft"、 "bottomRight":

新的 Selection 和 Key BindingsSelection

现在,用户可以将鼠标拖到终端窗口外,以继续选择上面和下面的文本。在最新的更新之后,能够通过双击或三次单击来选择文本部分。

Key Bindings

微软在键绑定中添加了对 OEM 键(_+-=|/?:”;’)的支持,它还可以为复制、复制文本而不使用换行符、粘贴和复制选项卡提供键绑定。用户将在 profiles.json 设置文件中找到这些文件,默认情况下,在“keybindings”属性中启用这些设置文件。

微软正在更新有关区段的文档链接,以帮助用户开始了解终端的基本和高级功能。它还包括指向 Github 页面的链接。

修复 BUG

主要内容有:

在 Windows Terminal 0.3 中,仍然无法看到所有打开的选项卡并在它们之间导航,目前还不清楚微软何时计划修复这个用户界面问题。

Windows Terminal

先记录后面再补充

在当前目录地址(使用场景都是 Windows Terminal 配置)打开 Windows Terminal:

PS> $ start-process -WorkingDirectory ($PWD.Path) "wt.exe"
# 或者
PS> $ start-process "wt.exe" -ArgumentList "-d","."
# 注意:
#   例如, 使用上面命令打开了 "E:/demo/test" 目录之后打开的窗口哪怕使用 \'cd\' 切换到 "E:/demo" 这个目录
#   使用 快捷键 \'shift + ctl + 1\' 打开都会实在 "E:/demo/test" 这个目录下而不是 "E:/demo" 这个目录
# 这点没有像 Linux 或者 MacOS 系统下的终端打开新的 tab 那样。
# 需要做到上面的功能,还要将 快捷键对应的 \'tab\' 创建时候的 \'start directory\' 设置为 "."
#   \'-ArgumentList\' 只对 "-d","." 有反应,如果是写成 "-d","$env:projectDirectory" 是不会有作用的

先记录后整理
快捷键说明
/// https://docs.microsoft.com/en-us/windows/terminal/customize-settings/actions
        /// https://docs.microsoft.com/en-us/windows/terminal/customize-settings/actions#accepted-modifiers-and-keys
        /**
         * PS:
         *      keys: \'+\' 和按键值之间不能为空
         *      多用 alt+ 或者 shift+alt+
         * 虽然允许 `win` 键,但是 `win` 配合 其他键 + 数字,会有其他效果,后面研究会出一篇文章 
         */
        /// 快捷键清屏
        { "command": { "action": "sendInput", "input": "clear\\r" }, "keys": "alt+k" },
        /// 打开 重命名 的 text box
        { "command": { "action": "openTabRenamer" }, "keys": "shift+alt+r" },
        { "command": { "action": "setTabColor", "color": "#FAFF59" }, "keys": "shift+alt+1" },
        /**
         * 打开 colorpicker, 下面的 alt+c+p 其实有效的是 alt+p c按键的值会input 到 screen 中
         */
        // { "command": { "action": "openTabColorPicker" }, "keys": "alt+c+p" }
        // 
        { "command": { "action": "openTabColorPicker" }, "keys": "shift+alt+p" }


我的 Windows Terminal 配置:

{
    "$schema": "https://aka.ms/terminal-profiles-schema",
    // 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"
        },
        /// https://docs.microsoft.com/en-us/windows/terminal/customize-settings/actions
        /// https://docs.microsoft.com/en-us/windows/terminal/customize-settings/actions#accepted-modifiers-and-keys
        /**
         * PS:
         *      keys: \'+\' 和按键值之间不能为空
         *      多用 alt+ 或者 shift+alt+
         * 虽然允许 `win` 键,但是 `win` 配合 其他键 + 数字,会有其他效果,后面研究会出一篇文章 
         */
        /// 快捷键清屏
        { "command": { "action": "sendInput", "input": "clear\\r" }, "keys": "alt+k" },
        /// 打开 重命名 的 text box
        { "command": { "action": "openTabRenamer" }, "keys": "shift+alt+r" },
        { "command": { "action": "setTabColor", "color": "#FAFF59" }, "keys": "shift+alt+1" },
        /**
         * 打开 colorpicker, 下面的 alt+c+p 其实有效的是 alt+p c按键的值会input 到 screen 中
         */
        // { "command": { "action": "openTabColorPicker" }, "keys": "alt+c+p" }
        // 
        { "command": { "action": "openTabColorPicker" }, "keys": "shift+alt+p" }
    ],
    "copyFormatting": "none",
    "copyOnSelect": false,
    "defaultProfile": "{574e775e-4f2a-5b96-ac1e-a2962a402336}",
    "profiles": 
    {
        "defaults": 
        {
            "cursorColor": "#FFFFFF",
            "cursorShape": "bar",
            "fontFace": "MesloLGS NF",
            "fontSize": 14,
            "startingDirectory": "."
        },
        "list": 
        [
            {
                "commandline": "C:\\\\Program Files\\\\PowerShell\\\\7\\\\pwsh.exe",
                "fontFace": "MesloLGM NF",
                "fontSize": 10,
                "guid": "{574e775e-4f2a-5b96-ac1e-a2962a402336}",
                "hidden": false,
                "name": "PowerShell",
                "source": "Windows.Terminal.PowershellCore",
                "startingDirectory": "."
            },
            {
                "fontSize": 11,
                "guid": "{58ad8b0c-3ef8-5f4d-bc6f-13e4c00f2530}",
                "hidden": false,
                "name": "Debian",
                "source": "Windows.Terminal.Wsl"
            },
            {
                "commandline": "powershell.exe",
                "fontFace": "DroidSansMono NF",
                "fontSize": 11,
                "guid": "{61c54bbd-c2c6-5271-96e7-009a87ff44bf}",
                "hidden": false,
                "name": "Windows PowerShell"
            },
            {
                "commandline": "powershell.exe -command Start-Process -Verb RunAs \\"shell:appsFolder\\\\Microsoft.WindowsTerminal_8wekyb3d8bbwe!App\\"",
                "hidden": false,
                "icon": "ms-appx:///Images/Square44x44Logo.targetsize-32.png",
                "name": "Windows Terminal (elevated)"
            },
            {
                "commandline": "powershell.exe -command Start-Process -Verb RunAs \\"wt.exe\\"",
                "hidden": false,
                "icon": "ms-appx:///Images/Square44x44Logo.targetsize-32.png",
                "name": "Windows Terminal (elevated2)"
            },
            {
                "commandline": "powershell.exe -command Start-Process -Verb RunAs \\"pwsh.exe\\"",
                "icon": "ms-appx:///ProfileIcons/pwsh.png",
                "name": "pwsh admin"
            },
            {
                "commandline": "cmd.exe",
                "fontSize": 10,
                "guid": "{0caa0dad-35be-5f56-a8ff-afceeeaa6101}",
                "hidden": false,
                "name": "\\u547d\\u4ee4\\u63d0\\u793a\\u7b26",
                "startingDirectory": "%USERPROFILE%"
            },
            {
                "guid": "{b453ae62-4e3d-5e58-b989-0a998ec441b8}",
                "hidden": false,
                "name": "Azure Cloud Shell",
                "source": "Windows.Terminal.Azure"
            }
        ]
    },
    "schemes": 
    [
        {
            "background": "#0C0C0C",
            "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",
            "purple": "#881798",
            "red": "#C50F1F",
            "selectionBackground": "#FFFFFF",
            "white": "#CCCCCC",
            "yellow": "#C19C00"
        },
        {
            "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"
        }
    ],
    "tabWidthMode": "compact",
    "theme": "dark"
}

以上是关于Windows Terminal 0.3发布:一系列改进和错误修复的主要内容,如果未能解决你的问题,请参考以下文章

怎样把gnome-terminal中的内容复制到windows下

Windows Terminal

Mac打造Windows Terminal同款终端

windows terminal 连接远程 ssh

Windows Terminal配置填坑记

Windows Terminal配置填坑记