Image

windows

Windows terminal

A nice terminal on Windows

3 min read
Last update: November 28, 2021
windows-terminal.webp
scoop is necessary

You will need to have scoop to install Windows terminal, if you don't install it, check this guide: scoop

Windows terminal is a recent terminal for Windows, by Microsoft.

Features

  • Tabs
  • JSON config
  • Multiple Shell profiles (even WSL if installed)
  • Shorcuts
  • Switch tabs Ctrl + Tab

Documentation

Installation

You can easily install it with scoop (from bucket extras). You can install it from Windows Store instead, if you like it.

PowerShell
sudo scoop install windows-terminal

You will find Windows Terminal in startup menu, launch it and you will see the new terminal, click on and select Settings (Ctrl + ,), this will open JSON configuration. Any update will be applied directly.

Here it's just an example, check official documentation if you want to know more about Windows terminal configuration.

This example will give you a terminal with black background, green font and two shortcuts: Ctrl + W to close tab and Ctrl + T to open new tab.

// ...
{
    // ...
    // replace 'defaultProfile' with new 'guid' profile
    "defaultProfile": "{79285a8e-036c-446f-8a9c-78994e34bf78}",
    // ...
    "profiles": {
        "defaults": {
            // ...
        },
        "list": [
            // ...
            {
                "guid": "{79285a8e-036c-446f-8a9c-78994e34bf78}",
                "hidden": false,
                "name": "Konsole",
                "commandline": "powershell.exe",
                // config
                "acrylicOpacity": 0.8,
                "backgroundImageOpacity": 0.7,
                "backgroundImageStretchMode": "uniformToFill",
                "closeOnExit": false,
                "colorScheme": "Konsole",
                "cursorHeight": 25,
                "cursorShape": "vintage",
                "fontFace": "Fira Code",
                "fontSize": 12,
                "icon": "C:/Users/username/Documents/WindowsPowerShell/icon.ico",
                "historySize": 9001,
                "padding": "0, 0, 0, 0",
                "snapOnInput": true,
                "startingDirectory": "C:/workspace",
                "useAcrylic": true
            }
        ]
    },
    // ...
    "schemes": [
        {
            "name": "Konsole",
            //
            "cursorColor": "#00FF00",
            "selectionBackground": "#FFFFFF",
            //
            "background": "#000000",
            "foreground": "#33FF00",
            //
            "black": "#2d3748",
            "blue": "#3465A4",
            "cyan": "#06989A",
            "green": "#b6b6b6",
            "purple": "#75507B",
            "red": "#CC0000",
            "white": "#219b02",
            "yellow": "#9c8000",
            "brightBlack": "#5bac0b",
            "brightBlue": "#729FCF",
            "brightCyan": "#34E2E2",
            "brightGreen": "#8AE234",
            "brightPurple": "#AD7FA8",
            "brightRed": "#EF2929",
            "brightWhite": "#b1b1b1",
            "brightYellow": "#FCE94F"
        }
    ],
    // ...
    "actions": [

        // ...

        {
            "command": "closePane",
            "keys": [
                "ctrl+w"
            ]
        },
        {
            "command": "newTab",
            "keys": [
                "ctrl+t"
            ]
        }
    ]
}

Profile

You can improve your current profile with some modules, so you need to find your current profile.

PowerShell
$PROFILE

Oh My Posh

Optional: upgrade your PowerShell to 7+

sudo scoop install Meslo-NF ; scoop install https://github.com/JanDeDobbeleer/oh-my-posh/releases/latest/download/oh-my-posh.json

Update Microsoft.PowerShell_profile.ps1, to find it, execute $PROFILE and you will get the path

Microsoft.PowerShell_profile.ps1
Invoke-Expression (oh-my-posh --init --shell pwsh --config "$(scoop prefix oh-my-posh)/themes/jandedobbeleer.omp.json")

Add "fontFace": "MesloLGM NF" to Windows Terminal JSOn settings

{
    "profiles": {
        "list": [
            {
                "guid": "{79285a8e-036c-446f-8a9c-78994e34bf78}",
                "fontFace": "MesloLGM NF",
            }
        ]
    }
}
scoop update oh-my-posh
oh-my-posh --print-shell

VS Code

Open JSON Settings in VS Code

{
    "terminal.integrated.automationShell.windows": "Windows.Terminal.PowershellCore",
    "terminal.integrated.fontFamily": "MesloLGM NF"
}

Update PowerShell

Download the Windows (x86) stable .msi version, update Settings JSON of Windows Terminal:

{
    "profiles": {
        "list": [
            {
                "guid": "{79285a8e-036c-446f-8a9c-78994e34bf78}",
                // "commandline": "powershell.exe",
                "commandline": "C:\\Program Files (x86)\\PowerShell\\7\\pwsh.exe",
            }
        ]
    }
}
The path of $PROFILE will be change, check it.