Tools

Microsoft Windows Gets an Open Source Terminal with Tabs, Rich Text Rendering

7 May 2019 9:22am, by

While the engine that powers the Windows console and command line has been getting updates to support Unicode, UTF-8, 24-bit color, VT sequences and other technologies used by rich command line interfaces, for legacy reasons the Windows console app itself hasn’t been able to take full advantage of them.

But not only does Microsoft use the console internally for critical tasks like the Windows build process, but back compatibility is vital for many industrial applications that depend on it and even the simplest changes to the user interface can break them.

To bring the experience up to date for developers without compromising that compatibility, Microsoft is launching a brand new Windows Terminal app built on the updated and refactored Windows console subsystem with support for rich fonts, configurable themes, multiple tabs, extensions and GPU-accelerated text rendering.

A PowerShell Core tab in the new Windows Terminal set to 25% background blur transparency.

“The new Windows terminal is a radical update of the command line experience,” Kevin Gallo, Corporate vice president of the Windows Developer Platform told the New Stack. “Our goal is to build the best terminal ever.”

“It has themes and lots of customizations. It has shortcuts. You can control windows differently; you can have tabs and you can define how you do workflow. We have support for modern features like Unicode, so you can use emojis and East Asian fonts are supported, which was a highly requested feature. It’s a very modern experience from a text visualization point of view.”

Windows Terminal is a Win32 app because it needs to connect to services the Universal Windows Platform (UWP) sandbox doesn’t have access to, but it’s built in XAML using XAML Islands, a technique that makes it possible to use new user interface elements from UWP. That means the tabbed user interface uses the new Windows 10 Fluent Design system for everything from transparency to themes.

Picking different command line shells as the profile for a tab in Windows Terminal.

You can open multiple tabs, each connected to a command line shell or app, and you can drag a tab to tear it away as a new window. The terminal supports all the WSL distros that are available for Windows 10, as well as PowerShell (Core and Windows) and CMD, but you could also have a tab that connects over SSH to a remote device like a Raspberry Pi. (If developers need the current Windows console app for bandwidth compatibility, they can still launch that by running CMD or PowerShell directly.)

Settings and configuration options are stored for each user, in a structured text file that developers can edit directly or that third-party tools can use to customize the Windows Terminal experience. You can save combinations of settings like font size and style, color theme, background blur and transparency as profiles and pick which profile to use in each tab or shell.

As well as multiple tabs, you can split each tab into multiple panes of different sizes, to show several applications at once, using tools like tmux. The rich color support lets developers do things that are standard on Linux but have been problematic in the Windows console — like taking text from an app like fortune, piping it through cowsay and piping that through lolcat, so the “quote of the day” shows up as if it’s being said by a multiple-colored cow.

An Ubuntu tab in Windows Terminal showing Unicode and emoji characters.

The text rendering is hardware accelerated, using DirectWrite and DirectX which delivers much faster performance, Gallo says; “If you type ‘dir,’ it’s phenomenally faster scrolling through a long directory listing.” That GPU-powered rendering makes a particular difference when working with large GitHub repos. “When you’re working in a GitHub repo and you have long lists of text flying out on screen, the last thing you want is for the rendering speed to slow down what’s happening.”

That GPU-accelerated text rendering engine will also be in the traditional Windows Console in the future and can render Unicode, UTF-8 and glyphs and symbols in fonts, including programming ligatures, icons and powerline symbols. That is less about letting developers use emoji in variable names and more about being able to support the full range of Unicode characters in all languages for variable and function names, as well as the Chinese/Japanese/Korean ideograms required for software to ship in China.

The icon for Windows Terminal.

Developers can add features and customize the Windows Terminal interface with extensions, which Microsoft will host in an extension marketplace, Gallo says. “We have one that shows previews for weblinks; when you hover over an HTTP address in Terminal, you get a preview of the site.”

But that’s not the only way developers can extend the new Windows Terminal; Microsoft is open sourcing the app, and the first version of it will be on GitHub from this week (the app will also be in the Windows Store this summer with the full release by the end of the year).

That includes the controls used to build Windows Terminal. Some of those are user interface controls like the Fluent tab control, which Windows developers will be able to use for their own applications (including Windows desktop applications using XAML Islands). But there are also the controls used to build the terminal itself (which now uses Standard Template Library C++ components for things like linked lists). In fact, open sourcing Windows Terminal means Microsoft is also open sourcing the standard Windows Console and the Windows Console subsystem, which hosts all Windows command-line infrastructure. Submitting pull requests to these projects could mean community contributions being merged into the Windows codebase.

Windows components that Microsoft has already open sourced have been more self-contained offerings like the Calculator. It’s unlikely that this is the precursor to substantial portions of the Windows OS becoming open source, but this is still a significant development for the platform. The Windows Console subsystem is a critical piece of infrastructure, dating back to the earliest days of Windows and open sourcing it speaks to how serious Microsoft is about making Windows a better platform for developers. That’s going to be a long-term project, but steps like Windows Terminal and WSL 2 are a good beginning.

Feature image: Using tmux to split an Ubuntu tab in Windows Terminal into multiple panes running different apps like midnight commander, htop and cowsay. All images courtesy of Microsoft.

A newsletter digest of the week’s most important stories & analyses.

View / Add Comments

Please stay on topic and be respectful of others. Review our Terms of Use.