windows:windows_terminal

文書の過去の版を表示しています。


Windows Terminal

Windows Terminal は Windows 10 向けの新しいコマンドプロンプトを提供する。Linux ターミナルのようにマルチタブなどの機能も提供されている。
2019/08/13 現在のバージョンは Windows Terminal (Preview) Version: 0.3.2171.0 である。
Microsoft Store からインストールできる。

サイト: Windows Terminal Preview v0.3 Release | Windows Command Line Tools For Developers
ソースコード: GitHub - microsoft/terminal: The new Windows Terminal, and the original Windows console host -- all in the same place!

Windows Terminal

CTRL + C : Cancel
CTRL + Shift + C : Copy
CTRL + Shift + V : Paste

Copy & Paste Keybindings · Issue #968 · microsoft/terminal · GitHub

Windows Terminal の設定はタブのドロップダウンから Settings を選択して json ファイルを編集する。
Windows Terminal Settings

profile.json
// 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": "{574e775e-4f2a-5b96-ac1e-a2962a402336}",
 
    "globals" : 
    {
        "initialCols" : 120,
        "initialRows" : 35
    },
    "profiles":
    {
        "defaults":
        {
            // Put settings here that you want to apply to all profiles
            "fontFace" : "HackGen",
            "fontSize" : 10,
            "backgroundImage": "C:\\Users\\tomoyan\\Pictures\\mg_chara.png",
            "backgroundImageStretchMode" : "none",
            "backgroundImageAlignment": "bottomRight",
            "backgroundImageOpacity": 0.5
            //"colorScheme": "Campbell"
            //"colorScheme": "Campbell Powershell"
            //"colorScheme": "Vintage"
            //"colorScheme": "One Half Dark"
            //"colorScheme": "One Half Light"
            //"colorScheme": "Solarized Dark"
            //"colorScheme": "Solarized Light"
        },
        "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,
                "colorScheme": "One Half Dark"
            },
            {
                "guid": "{574e775e-4f2a-5b96-ac1e-a2962a402336}",
                "hidden": false,
                "name": "PowerShell Core",
                "source": "Windows.Terminal.PowershellCore",
                "colorScheme": "Campbell"
            },
            {
                "guid": "{d3f31bee-5823-5ed8-8e04-f31ed54f2cd9}",
                "hidden": false,
                "name": "FedoraRemix",
                "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
    "schemes": [],
 
    // Add any keybinding overrides to this array.
    // To unbind a default keybinding, set the command to "unbound"
    "keybindings": []
}

backgroundImage は 400 x 300px の png 画像を使用。

GUID を生成する。

> powershell -Command "[Guid]::NewGuid()"

Guid
----
a9c3b42d-34ef-4488-aba4-98fca245f6b9

生成した GUID を使用して profiles を以下の様にすると MSYS2 MinGW 64-bit が上手くタブになる。

profile.json
{
    "profiles" :
    [
    ...
        {
            "acrylicOpacity" : 0.75,
            "closeOnExit" : true,
            "colorScheme" : "Campbell",
            "commandline" : "cmd.exe /c \"set CHERE_INVOKING=1&& set MSYSTEM=MINGW64&& C:\\msys64\\usr\\bin\\bash.exe --login\"",
            "cursorColor" : "#FFFFFF",
            "cursorShape" : "bar",
            "fontFace" : "Consolas",
            "fontSize" : 10,
            "guid" : "{a9c3b42d-34ef-4488-aba4-98fca245f6b9}",
            "historySize" : 9001,
            "icon" : "ms-appx:///ProfileIcons/{0caa0dad-35be-5f56-a8ff-afceeeaa6101}.png",
            "name" : "MSYS2 MinGW 64-bit",
            "padding" : "0, 0, 0, 0",
            "snapOnInput" : true,
            "startingDirectory" : "c:\\msys64\\home\\%USERNAME%",
            "useAcrylic" : true
        },

Windows Terminal MSYS2

参考文献

失敗例

生成した GUID を使用して profiles を以下の様に追加してみたが、MSYS2 MinGW 64-bit は起動できるもののタブにはならなかった。(別窓になってしまう)

profile.json
{
    "profiles" :
    [
    ...
        {
            "acrylicOpacity" : 0.75,
            "closeOnExit" : true,
            "colorScheme" : "Campbell",
            "commandline" : "C:\\msys64\\msys2_shell.cmd -mingw64",
            "cursorColor" : "#FFFFFF",
            "cursorShape" : "bar",
            "fontFace" : "Consolas",
            "fontSize" : 10,
            "guid" : "{a9c3b42d-34ef-4488-aba4-98fca245f6b9}",
            "historySize" : 9001,
            "icon" : "ms-appx:///ProfileIcons/{0caa0dad-35be-5f56-a8ff-afceeeaa6101}.png",
            "name" : "MSYS2 MinGW 64-bit",
            "padding" : "0, 0, 0, 0",
            "snapOnInput" : true,
            "startingDirectory" : "%USERPROFILE%",
            "useAcrylic" : true
        },

defaultProfileprofilesguid を設定すると変更できる。

"profiles" :
[
    {
        ...
        "commandline" : "powershell.exe",
        "guid" : "{61c54bbd-c2c6-5271-96e7-009a87ff44bf}",
        "name" : "Windows PowerShell",
        ...
    },
    {
        ...
        "commandline" : "cmd.exe",
        "guid" : "{0caa0dad-35be-5f56-a8ff-afceeeaa6101}",
        "name" : "cmd",
        ...
    },
],        

defaultProfile{61c54bbd-c2c6-5271-96e7-009a87ff44bf}(Windows PowerShell) から {0caa0dad-35be-5f56-a8ff-afceeeaa6101}(cmd) に変更する。

profile.json
{
    "globals" : 
    {
        "alwaysShowTabs" : true,
        "defaultProfile" : "{0caa0dad-35be-5f56-a8ff-afceeeaa6101}",
        "initialCols" : 120,
        "initialRows" : 30,
        "keybindings" : 
        [
            {
                "command" : "closePane",
                "keys" : 
                [
                    "ctrl+shift+w"
                ]
            },
  • windows/windows_terminal.1583703931.txt.gz
  • 最終更新: 2020/03/09 06:45
  • by ともやん