Even though I've never really earned the official "Software Developer" badge throughout the 15+ years of my career, I've had my fair share of writing scripts and some basic code over many projects I've worked on. I think we all agree, it's part of being defined as some sort of an "IT Engineer" these days to be able to use command line in any situation.
And even though I've been a Mac user for more than half of my career due to it's simplicity and the fact that my work apps are fairly straight forward to configure on a iOS device (and no, I'm not here to start the whole debate on whether it's any better or easier than Android: YMMV), I've also been an avid Linux user as I still use Mutt+MBSync for my personal mail configuration even for G-Suite or Exchange / M365 based mail accounts I've had for many years. That also means, I'm usually living in the Terminal space quite a fair bit compared to my Graphical User Interface space during my personal time.
With the ThinkPad now dominating my day-to-day life (for work use and productivity - Powerpoint, mainly), I've now decided to give Windows Terminal a good try.
I've never really used any other Terminal on Windows in detail, so when I first launched Windows Terminal I first thought it was rather clean and neat my liking (coming from BSPWM and Termite with add-ons). According to the screenshot from the Microsoft Store, it appeared Windows Terminal gave one the flexibility in customising bits and pieces that will allow you to beautify some part of your daily interaction with a Shell prompt.
Shell? Terminal?
Before we jump right in, let's review couple of notes. There is a sublet different between a Shell and a Terminal.
A Shell is as one would imagine is the core of the command line interface. Shells come in various flavours - such as Powershell, zsh, bash, ksh, etc.. Shells can run on Windows, Linux, Mac, BSD, etc...
A Terminal is a wrapper that allows you to run a shell inside the terminal. Think of it like terminal being the UI program that has a border, sets the colour schemes, allows you to set fonts for the shell you want to run. A terminal allows you to present the shell so you can actually type or run some commands via the command line interface. Terminals also come in various flavours - such as xterm, Windows Terminal, termite, etc... and can run on various platforms. You can run as many terminals (as your memory permits) and have their own process id's, but some terminals allow you to fork a child process so you can run multiple terminals from a parent terminal process for better memory management.
For Windows, there is no hard requirement to have any Linux based Shell available to use Windows Terminal. Powershell is also a "Shell" that can run inside Windows Terminal, but if you need a more "Linux" touch shell inside Windows Terminal, then you may choose to configure WSL (Windows Subsystem for Linux) on your device and have it run inside Terminal. A guide on how to install WSL is already available on https://docs.microsoft.com/en-us/windows/wsl/install-win10.
For this guide, I'll be installing WSL and also Ubuntu 18.04 LTS from the Microsoft Store for a demonstration.
Configuration
Once you've deployed WSL, your choice of a Linux distribution, and Windows Terminal, hit on Settings within Windows Terminal:
Settings is a simple JSON typed file. When you click on Settings, the file will be opened in your favourite editor. You'll then be presented with the JSON file where you can change to your liking:
// This file was initially generated by Windows Terminal 1.1.2021.0
// It should still be usable in newer versions, but newer versions might have additional
// settings, help text, or changes that you will not see unless you clear this file
// and let us generate a new one for you.
// 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": "{61c54bbd-c2c6-5271-96e7-009a87ff44bf}",
// You can add more global application settings here.
// To learn more about global settings, visit https://aka.ms/terminal-global-settings
// If enabled, selections are automatically copied to your clipboard.
"copyOnSelect": false,
// If enabled, formatted data is also copied to your clipboard
"copyFormatting": false,
// A profile specifies a command to execute paired with information about how it should look and feel.
// Each one of them will appear in the 'New Tab' dropdown,
// and can be invoked from the commandline with `wt.exe -p xxx`
// To learn more about profiles, visit https://aka.ms/terminal-profile-settings
"profiles":
{
"defaults":
{
"useAcrylic": true,
"acrylicOpacity": 0.8
},
"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": "Command Prompt",
"commandline": "cmd.exe",
"hidden": false
},
{
"guid": "{c6eaf9f4-32a7-5fdc-b5cf-066e8a4b1e40}",
"hidden": false,
"closeOnExit": "always",
"name": "Ubuntu-18.04",
"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.
// To learn more about color schemes, visit https://aka.ms/terminal-color-schemes
"schemes": [],
// Add custom keybindings to this array.
// To unbind a key combination from your defaults.json, set the command to "unbound".
// To learn more about keybindings, visit https://aka.ms/terminal-keybindings
"keybindings":
[
// Copy and paste are bound to Ctrl+Shift+C and Ctrl+Shift+V in your defaults.json.
// These two lines additionally bind them to Ctrl+C and Ctrl+V.
// To learn more about selection, visit https://aka.ms/terminal-selection
{ "command": {"action": "copy", "singleLine": false }, "keys": "ctrl+c" },
{ "command": "paste", "keys": "ctrl+v" },
// Press Ctrl+Shift+F to open the search box
{ "command": "find", "keys": "ctrl+shift+f" },
// Press Alt+Shift+D to open a new pane.
// - "split": "auto" makes this pane open in the direction that provides the most surface area.
// - "splitMode": "duplicate" makes the new pane use the focused pane's profile.
// To learn more about panes, visit https://aka.ms/terminal-panes
{ "command": { "action": "splitPane", "split": "auto", "splitMode": "duplicate" }, "keys": "alt+shift+d" }
]
}
Notice the use of the following within the profiles-defaults section:
"useAcrylic": true,
"acrylicOpacity": 0.8
What this means is that for every window that is created by Terminal, use transparency of 80%. The lower the number, the more transparent your windows will be.
Under profiles, this is where a list of all the shells you can use are defined. By default (if you have installed WSL), one will have Powershell, Command Prompt, WSL and Azure CLI profiles defined and have those setup as shells (profiles) available for Windows Terminal.
Suppose I have Open Sans installed on my device and would like to use that for my fonts for the WSL profile. Once I've installed Open Sans font (https://fonts.google.com/specimen/Open+Sans), I can now use that font for the WSL profile section within my Settings. Sample of where to add this and what it should look like under the WSL profile would be (in red):
{
"guid": "{c6eaf9f4-32a7-5fdc-b5cf-066e8a4b1e40}",
"hidden": false,
"fontSize": 11,
"fontFace": "Open Sans Regular",
"closeOnExit": "always",
"name": "Ubuntu-18.04",
"source": "Windows.Terminal.Wsl"
},
Once you save the profile, you'll notice the fonts have changed.
But let's try something else - maybe a new colour scheme.
I'm a huge fan of the Nord colour scheme (https://www.nordtheme.com/). I've been using it on all of my Linux distribution, and wanted my Windows Terminal to match as well. Color schemes can be defined in the schemes array of your Settings file. Unfortunately, the actual website doesn't have a Windows Terminal predefined script, but luckily someone had done this previously (https://github.com/arcticicestudio/nord/issues/123) and the colour scheme is written in the following format:
{
"name": "Nord",
"foreground": "#D8DEE9",
"background": "#2E3440",
"black": "#3B4252",
"red": "#BF616A",
"green": "#A3BE8C",
"yellow": "#EBCB8B",
"blue": "#81A1C1",
"purple": "#B48EAD",
"cyan": "#88C0D0",
"white": "#E5E9F0",
"brightBlack": "#4C566A",
"brightRed": "#BF616A",
"brightGreen": "#A3BE8C",
"brightYellow": "#EBCB8B",
"brightBlue": "#81A1C1",
"brightPurple": "#B48EAD",
"brightCyan": "#88C0D0",
"brightWhite": "#E5E9F0"
}
Once you have this under the schemes section, you'll now need to add to the WSL profile for the changes to occur when I save the Settings file:
"colorScheme": "Nord",
So now you have a fairly colourful terminal on your Windows Desktop! I have even tried using a different font all-together!
Fairly easy to customize your Windows Terminal and I'm satisfied with the changes. Let me know if you get around to this :D
Comments