💾 Archived View for pwshnotes.flounder.online › gemlog › 2021-08-17-installing-windows-terminal.gmi captured on 2021-12-04 at 18:04:22. Gemini links have been rewritten to link to archived content
⬅️ Previous capture (2021-12-03)
-=-=-=-=-=-=-
By default, Windows uses the Windows Console Host to host command-line applications like PowerShell. Console Host is a legacy product. And, over the past seven years, Microsoft has been working to simplify the architecture surrounding terminal applications. Most of the result is infrastructure on which things users care about, like applications, are built. One side effect has been Windows Terminal.
Windows Terminal is both a demonstration of the new pseudo terminal architecture and a full working terminal in its own right. It represents the cutting edge of Microsoft's work on terminals. And it is a worthy replacement for the classic console host interface.
On a daily basis, the two most noticeable features of Windows Terminal are: It allows multiple different shells to run simultaneously: each in their own tab; and many users customize their Terminal background with a custom image.
Windows Terminal is available from the Microsoft Store and as a package from GitHub. In both cases, Windows Terminal is published as a Universal Windows Platform app in MSIX format.
I won't assume that you have a Microsoft account. So, today, I will download the package from GitHub and install it.
One consequence of manually installing a MSIX package is that we'll need to drop to PowerShell 5.1 to access the relevant package tool.
I will also download an image and set it as the background for Terminal. This is controlled by the Terminal settings. I will use the Settings app included with Terminal to set the background.
It is also possible to edit the settings file directly. After installing Windows Terminal, you can open settings.json in Notepad with this PowerShell one-liner:
notepad $env:LocalAppData\Packages\Microsoft.WindowsTerminal_8wekyb3d8bbwe\LocalState\settings.json
We'll need to execute a cmdlet from PowerShell 5.1 to install the downloaded package.
$PSVersionTable Name Value ---- ----- PSVersion 5.1.19041.1151 ...
Set-Location ~\Downloads
Add-AppxPackage .\Microsoft.WindowsTerminal_1.9.1942.0_8wekyb3d8bbwe.msixbundle
An instance of Windows Terminal will now launch.
Windows Terminal automatically creates profiles for common shells like Command Prompt (cmd.exe), Windows PowerShell (powershell.exe), PowerShell (pwsh.exe), and others. See link below.
By default, Terminal will launch PowerShell or Windows PowerShell depending on what is installed locally.
A tab bar will show along the top of Windows Terminal. To the right of any tabs will be two buttons: a '+' symbol which allows you to add a new tab and a down-arrow or 'V' symbol which opens a menu.
Background images are set for each profile. By default, there is one profile for each type of shell present on the system (ex Windows PowerShell; PowerShell). This means that each shell will have its own background image.
Because I installed PowerShell 7 on my system prior to installing Windows Terminal, "PowerShell" is my default Windows Terminal profile. And I will focus my attention on setting the background image for "PowerShell".
Depending on the physical size of your Terminal window, some of the setting labels might be collapsed. I suggest enlarging your Terminal window until the labels show on the left.
Related settings are grouped together under a common label which shows on the left: ex Startup; Interaction. Beneath this, there is a subsection, Profiles, with a label for each profile.
Within the content area of Settings, there will be three tabs: General, Appearance, and Advanced.
The PowerShell tab will now show the background image you selected.
If you find the background image overwhelms any text printed in the Terminal, it is possible to darken the image.
This should make the image much darker. And it should be easier to read any text present in the Terminal.
One of the pain points for earlier versions of Windows Terminal was that right-clicking always paste the contents of the clipboard into the shell. This can lead to disaster by executing random commands contained in your clipboard. This is a common issue. You would only need to copy a few lines of code and right-click in Terminal by accident. The key issue is that pasting the newline character is equivalent to pressing the Enter key. This is how the clipboard contents are run.
Newer versions of Windows Terminal have a multiLinePasteWarning setting which defaults to true. This divides pasting into two scenarios.
If your clipboard does not contain a newline then right-clicking will paste the contents of your clipboard into Terminal. In this case, the worst possible outcome is that the line you're currently editing is modified.
However, if your clipboard contains any newlines, you will receive the following warning:
Warning
You are about to paste text that contains multiple lines. If you paste this text into your shell, it may result in the unexpected execution of commands. Do you wish to continue?
Clipboard contents (preview):
[The contents of your clipboard.]
Paste anyway Cancel
This prompt explains the issue and prevents you from running the contents of your clipboard by accident. It also shows you a convenient preview of your clipboard contents to help you make a decision.
This feature lowers the risk of using Terminal compared to earlier versions.
Windows Terminal Latest Release | GitHub
What default profiles will Windows Terminal create? | Microsoft Docs
Windows Terminal | Microsoft Store
Created: Tuesday, August 17, 2021
Updated: Tuesday, August 17, 2021