技巧02--Terminal Preview优化与美化


0x00 下载安装

可在MS应用商店安装,也可以直接百度下载安装包安装

image-20220124133729971

0x01 设置默认自启

image-20220124133457658

0x02 Terminal Preview美化

image-20220124145601910

1、打开终端settings

image-20220123215947648

2、点击这个Open JSON file

保存一下这个文件位置

C:\Users\DELL\AppData\Local\Packages\Microsoft.WindowsTerminalPreview_8wekyb3d8bbwe\LocalState

image-20220123220044494

3、将settings.json备份!!稍有不测,就复制粘贴回来

image-20220123215415089

4、打开settings.json文件,对照下面的文档进行编辑

// This file was initially generated by Windows Terminal 1.0.1401.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",
    // 默认使用的终端 (ubuntu/powershell/cmd....)
    "defaultProfile": "{c6eaf9f4-32a7-5fdc-b5cf-066e8a4b1e40}",
    // You can add more global application settings here.
    // To learn more about global settings, visit https://aka.ms/terminal-global-settings
    // 主题设置
    "theme": "dark", // --------- 这里有改动 ------------- "dark/light/system" 就标题栏有变化....
    // 启动设置
    // 1、以最大化方式启动
    "launchMode": "default", // "maximized"
    // 2、启动位置
    "initialPosition": "100,50",
    // 3、首次启动时的列
    "initialCols": 100,
    // 4、首次启动时的行
    "initialRows": 30,
    // If enabled, selections are automatically copied to your clipboard.
    "copyOnSelect": true, // --- 这里有改动 ----默认 false  , 选中复制,右键粘贴
    // If enabled, formatted data is also copied to your clipboard
    "copyFormatting": false,
    // 滚动速度
    "rowsToScroll": "system", // 这是滚动鼠标滚轮一次滚动的行数 默认 "system"
    // 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": {
            // 初始目录设置
            "startingDirectory": "C:/Users/yogurt/Desktop/",
            // 文本设置
            // 字体
            "fontFace": "Cascadia Mono",
            // 字体大小
            "fontSize": 13,
            // 边距
            "padding": "2,2,2,2",
            // 消除文本锯齿
            "antialiasingMode": "cleartype",
            // 颜色设置
            // 配色方案,   配色方案是在 schemes 对象中定义的, 有几个预先定义的方案, 查看 https://docs.microsoft.com/zh-cn/windows/terminal/customize-settings/color-schemes
            "colorScheme": "One Half Dark", // One Half Dark,  One Half Light,  Solarized Dark,  Solarized Light, 
            // Acrylic 设置
            "useAcrylic": true,
            // Acrylic 不透明度
            "acrylicOpacity": 0.8,  
            // // 背景图像设置
            // "backgroundImage":  "C:/Users/yogurt/Pictures/Saved Pictures/background.png",
            // // 背景图像拉伸模式 "none"、"fill"、"uniform"、"uniformToFill"
            // "backgroundImageStretchMode": "uniform",
            // // 背景图像不透明度
            // "backgroundImageOpacity": 0.8,
            // 历史记录可现实行数
            "historySize": 9001 // default 9001 
        },
        "list": [
            {
                // Make changes here to the powershell.exe profile.
                "guid": "{61c54bbd-c2c6-5271-96e7-009a87ff44bf}",
                "name": "Windows PowerShell",
                "commandline": "powershell.exe",
                "hidden": false
            },
            {
                // Make changes here to the cmd.exe profile.
                "guid": "{0caa0dad-35be-5f56-a8ff-afceeeaa6101}",
                "name": "命令提示符",
                "commandline": "cmd.exe",
                "hidden": false
            },
            {
                "guid": "{c6eaf9f4-32a7-5fdc-b5cf-066e8a4b1e40}",
                "hidden": false,
                "name": "Ubuntu-18.04",
                "source": "Windows.Terminal.Wsl"
            },
            {
                "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"
        },
        // 下面是我自定义的快捷键
        {
            "command": "closePane",
            "keys": "ctrl+w"
        },
        {
            "command": "closeTab",
            "keys": "ctrl+shift+w"
        }
    ]
}

对比一下,就知道在哪里更改图片背景啥的了。

image-20220123220535822

5、对照相应的位置,复制粘贴过来,去掉注释

image-20220123221334224

6、从网上找几张自己喜欢的图片,改一下配置即可,支持实时更改显示,挺方便的。

image-20220123223852902

踩坑经验

1、注意背景图片路径是/而不是反斜杠\!!!!

image-20220123224153620

2、复制过来的时候,下面},被移到了注释那里,改过来就行

image-20220123224339560

0x03 设置置顶

image-20220124133425370