Stephen Hara

Trying the New Windows Terminal

Published on 5/7/2019

  • post
  • terminal
  • software-engineer

If you're a developer who primarily works with Windows (such as myself), you know that the terminal experience kinda sucks. If you stick with Microsoft terminals, you have cmd or the Powershell terminal, neither of which have tabs, so you'll probably have several open at once. Venturing into third-party options is okay - hyper looks nice, but trying to run vim inside of it gave me all sorts of problems. cmder is actually pretty nice, but the difficulty in setting a default directory bothered me enough that I just went back to cmd.

Today, however, at Microsoft Build, they announced a new Terminal!

And it looks pretty awesome. So I'm gonna try it out.

Preparation

For right now, it can't simply be installed. It can be built from source, but according to this reddit comment (thanks u/zadjii!), there are a few prerequisites, reiterated here:

  • Running Windows Terminal requires Windows 1903 (build >= 10.0.18362.0), which you can check in System Information. Currently this is only available as a Windows Insider build (directions here)
  • As well as Visual Studio 2017 or greater with the "Desktop Development with C++" and "Universal Windows Platform Development" packages installed
  • From your chosen VS installer, you also need the 1903 SDK from Individual components if you don't install it separately
  • For VS2019 at least, you'll also need the latest build tools: MSVC v142 - VS2019 C++ x64/x86 build tools (v14.20) and (unsure if necessary, but probably a good idea) associated Spectre-mitigated libs
  • Of course, you can't build the source without the source!
  • Presumably you've cloned the source repo, and you'll also need to run two commands: git submodule update --init --recursive and nuget restore OpenConsole.sln inside the repo directory
  • And lastly, in your Windows Developer Settings, you need Developer Mode set
  • NOTE: The WinRT package may also be required as per this Github comment from rw3iss

From here, with VS201X open the OpenConsole.sln solution file in the source. To use the v142 build tools, you'll need to right-click the OpenConsole solution and select Retarget Solution, then target the v142 tools and the 10.0.18362.0 SDK.

Set your build target to Release x64, then build with Ctrl+Shift+B. If all goes well, you can now select Build > Deploy Solution, and upon success it should show up in your Start menu. Then you just open it!

You'll probably get this error

If you're getting compile errors regarding 'function' is not a member of 'std', I took the solution from this PR which is adding the following line to src/inc/LibraryIncludes.h:

#include <functional>

First Impression/Notes

There's one thing that basically guarantees I'll be using Windows until I die thanks to this.

TABS!

When you first open it, it looks like a standard cmd window: new-windows-terminal-1

But give it the good ol' universal tab key combo, Ctrl+T, and my god it's beautiful: new-windows-terminal-2

I might cry. Like the emojis that are now supported by the rendering engine. new-windows-terminal-10

That out of the way, onto other things.

On the top right you probably see the down arrow which you might surmise leads to a menu - what we can see in the Terminal menu is basically just a list of shells, a Settings button that opens a profile.json in some voodoo Roaming directory, and a Feedback button that opens the general Windows Feedback Hub. So not a lot there.

The profile.json is initially flattened, but we can format it easily enough to see the top-level options:

{
     "alwaysShowTabs": false,
     "defaultProfile": "{a699846e-2d03-429b-8346-e47a0e1c4234}",
     "experimental_showTabsInTitlebar": false,
     "initialCols": 120,
     "initialRows": 30,
     "profiles": [...],
     "schemes": [...],
     "showTerminalTitleInTitlebar": true
 }

profiles has two objects with name fields corresponding to what we saw in the Terminal menu, cmd and Powershell, so we can infer that console-like applications, likely those built off of conhost.exe, can be included here.

defaultProfile determines what profile is loaded when you open a new tab/window, identified by a GUID field on each profile entry.

schemes is just definitions for some color schemes, defaulting to Campbell (used in the screenshots above) and Solarized Light/Dark for the cool kids.

new-windows-terminal-4 Solarized Dark doesn't go too well with Powershell...

new-windows-terminal-5 Solarized Light is pretty solid though.

new-windows-terminal-6 And it still works nicely with bash prompt colorings!

It live reloads when the settings change, which is pretty nice, but it has crashed once, so best to play with settings on a fresh instance.

Setting alwaysShowTabs to true gives you this, which could look better: new-windows-terminal-7

And should probably be true by default, but hey, at least we got 'em!

For science I added a new profile to run bash.exe, called it bash, and gave it a new GUID from an online generator, then set it to my default. As you would expect, it worked like a charm for new tabs and new windows! new-windows-terminal-8

In Summary

I've only played with the new Windows Terminal for around an hour or so, but it's been pleasant and feels promising as far as command line experiences in Windows go. I'll use this as my primary terminal for a while and see how it goes and probably write a follow-up post, but in the meantime, hopefully this post is helpful for anyone looking to build and try it out before it gets properly distributed via the Windows Store or some other method.

This page brought to you by Stephen Hara.