Customize the Windows Terminal like a boss

Featured image

The Microsoft Windows Terminal was announced back in May 2019, and is the future home of the shell on Windows operating systems.

What’s the difference between a shell and a terminal

Scott Hanselman has a great detailed explanation of the differences, however, the TLDR is this:

A shell is the program that processes commands and returns output. For example, Windows command prompt, powershell, bash etc.

A terminal refers to a wrapper program that runs a shell.

The Windows Terminal (Codename: Cascadia) is an open source project that is still under development by Microsoft and will be shipped with a future version of Windows. But if you’re anything like me and simply can’t wait to get your hands on the new and shiny things, there’s a way to do that, too.

How to install the Windows Terminal

One way to get the terminal is to download it from github and compile it yourself. I’ve done this before, and I can tell you from experience that it’s a total pain in the ass.

The simplest (and my preferred) method, is to get yourself onto a Windows Insider build of Windows 10 by joining the Windows Insider program, and download the Windows Terminal application from the Microsoft Store.

file

Customizing the terminal

Settings.json

All of the configuration settings for the terminal are stored in a json document located at C:\Users\<USERNAME>\AppData\Local\Packages\Microsoft.WindowsTerminal_8wekyb3d8bbwe\LocalState\profiles.json

This can easily be edited by selecting Settings from the dropdown or CTRL + ,.

file

In version 0.5 of the Terminal app, the settings.json has been reworked to include a new $schema that allows for intellisense and autocomplete. If you have installed a version before 0.5, you will need to rename (or delete) your existing settings.json. Opening the terminal again will generate a fresh settings.json with the new schema.

Profiles

The configuration of each shell that is available in the Windows Terminal app is defined by a profile within settings.json.

A default shell profile looks like this:

{
  // Make changes here to the powershell.exe profile
  "guid": "{61c54bbd-c2c6-5271-96e7-009a87ff44bf}",
  "name": "Windows PowerShell",
  "commandline": "powershell.exe",
  "hidden": false
}

guid: Unique identifier of the profile. Written in registry format: "{00000000-0000-0000-0000-000000000000}". name: Name of the profile. Displays in the dropdown menu. commandline: Executable used in the profile. hidden: If set to true, the profile will not appear in the list of profiles.

Create a new profile

Let’s get our hands dirty and create a new profile.

The first thing I’m going to do is to download a new shell from the Windows Store so I can show the process end-to-end. In this example, I’m going to choose Kali Linux, because I’m a bad-ass.

file

One that’s installed, I can open the shell by selecting it from my start menu.

file

When I do, the Kali shell will open in a separate window just like all the other shells normally would. B-O-R-I-N-G! Let’s get this bad boy in the Windows Terminal!

  1. Open the settings and create a new profile.
  2. Generate a new guid by using the New-Guid powershell command. file
  3. Set the name to Kali Linux
  4. Set the source to wsl --distribution kali-linux
You can find out the name of the linux distribition with the wsl --list command.

file

The new profile looks like this:

{
  "guid": "{e6676464-d065-46d9-9731-9637a6b236eb}",
  "hidden": false,
  "name": "Kali Linux",
  "source": "wsl --distribution kali-linux"
}

Once the profile is saved it’s instantly available within Windows Terminal (no need for a reload!)

file

A full list of configurable settings can be found here


As of version `0.5.2762.0`, as soon as you launch and configure a newly installed shell for the first time, Windows Terminal will automatically detect and configure a new profile! NEAT-O!

Schemes

The Schemes section is where we can add ✨bling✨ to the terminal.

A scheme consists of a bunch of key-value pairs that set colour properties for the terminal to their hex represented colour values.

There is a massive library of predefined themes available from https://iterm2colorschemes.com/. Find a theme you like, and grab the JSON representation of the theme from this GitHub repo.

If you want to rock your WSL in true Ubuntu style, first import the Ubuntu colour scheme.

Next, download and install the official Ubuntu fonts.

And lastly, modify the Ubuntu profile to use the new font and colour scheme.

{
    "guid": "{2c4de342-38b7-51cf-b940-2309a097f518}",
    "hidden": false,
    "name": "Ubuntu",
    "colorScheme": "Ubuntu",
    "source": "Windows.Terminal.Wsl",
    "fontFace": "Ubuntu Regular"
},

file

I’ve put my custom KaliLegit scheme on my GitHub in case you wanted that one too.

file

For Powershell, I went with a theme called Pandora.

file

Custom backgrounds

The Windows Terminal supports custom background images. I find this useful to make different versions of a shell (for example, Powershell 5 and Powershell 7 core) visually distinct, so I never get confused as to which shell i’m in.

  1. Grab an image, and place it inside the same directory as your profiles.json. (You can put the file anywhere, the above directory just happens to be convenient)
  2. Open the Windows Terminal settings (CTRL + ,)
  3. Under your shell profile, add the following configuraition items, swapping out the location of your image.
"backgroundImage": "ms-appdata:///Local/powershell-core.jpg",
"backgroundImageOpacity": 0.25,
"backgroundImageAlignment": "center",
"backgroundImageStretchMode": "uniformToFill",
"useAcrylic": false
  1. Save the file and verify the changes file

You may need to have a fiddle with your color scheme or image opacity to make the text visible on top of your image.

Instead of using the UWP URI for the image location, you can use a:

Key bindings

The keybindings section does exactly what it says on the tin. It lets you define custom keybindings for commands that are available in the Windows Terminal.

A keybinding is set like this:

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

When using VSCode the settings schema will provide auto-fill suggestions when editing your profiles.json file and it will also provide definitions of each property.

file