Windows Terminal + Alpine Linux + ZSH: Creating Your Stylish Terminal

Publish: 2020-11-16 | Modify: 2020-11-16

Windows Terminal is a modern terminal application for command-line tools and shells (such as Command Prompt, PowerShell, and Windows Subsystem for Linux (WSL)). Its main features include multiple tabs, panes, Unicode and UTF-8 character support, GPU-accelerated text rendering engine, and the ability to create your own themes and customize text, colors, backgrounds, and shortcuts.

Windows Terminal Overview

After installing Windows Terminal, you may find that it doesn't meet the official demo effect. It may look black and ugly. However, Windows Terminal can be highly customized to achieve your desired effect. This article shares xiaoz's own solution.

Installing Windows Terminal

Windows Terminal has been released as a stable version. Open Microsoft Store and search for "Windows Terminal" to install it.

Windows Terminal Installation

Windows Terminal Color Scheme

The default color scheme of Windows Terminal is not very attractive (it can only be said to be slightly better than the built-in CMD). We can achieve our own color scheme by modifying the configuration file. Open the configuration file by pressing Ctrl + , in the terminal interface. The configuration file is in JSON format.

I recommend a Windows Terminal theme website: https://windowsterminalthemes.dev/. Open this website, choose your favorite color scheme, and click "Get theme" to automatically copy the color scheme to the clipboard.

Windows Terminal Theme Website

Open the Windows Terminal configuration file and paste the color scheme code into the profiles.defaults field. It should look like this:

Windows Terminal Configuration

If you want to set transparency for the terminal, you can continue adding two lines to the profiles.defaults field:

"useAcrylic": true, 
"acrylicOpacity": 0.8,
  • useAcrylic: Enables acrylic texture effect.
  • acrylicOpacity: Sets the opacity (this property only takes effect when useAcrylic is set to true).

Here is my color scheme code for reference:

"defaults":
{
    "useAcrylic": true, 
    "acrylicOpacity": 0.8,
    "name": "Zenburn",
    "black": "#4d4d4d",
    "red": "#705050",
    "green": "#60b48a",
    "yellow": "#f0dfaf",
    "blue": "#506070",
    "purple": "#dc8cc3",
    "cyan": "#8cd0d3",
    "white": "#dcdccc",
    "brightBlack": "#709080",
    "brightRed": "#dca3a3",
    "brightGreen": "#c3bf9f",
    "brightYellow": "#e0cf9f",
    "brightBlue": "#94bff3",
    "brightPurple": "#ec93d3",
    "brightCyan": "#93e0e3",
    "brightWhite": "#ffffff",
    "background": "#3f3f3f",
    "foreground": "#dcdccc"
},

Installing Alpine Linux

This step is optional. If you want to experience Linux on Windows, you can continue to install Linux through WSL. First, refer to: Enabling Linux Subsystem (WSL) on Windows 10, then search for "Alpine Linux" in the Microsoft Store to install it (you can also choose other Linux distributions).

Installing ZSH on Alpine Linux

Execute the following commands to install ZSH:

# Install the required dependencies first
apk add zsh curl wget git
# Install ZSH
sh -c "$(curl -fsSL https://raw.github.com/ohmyzsh/ohmyzsh/master/tools/install.sh)"
# Change ZSH to the default shell
sed -i -e "s/bin\/ash/bin\/zsh/" /etc/passwd

Conclusion

The settings of Windows Terminal are not user-friendly as they require manual modification of the configuration file. Although it is not complex, it can be a bit cumbersome. However, once modified, it will be a one-time effort. If you like to tinker, you can give it a try. Lastly, here is a screenshot of my own setup.

Windows Terminal Screenshot

This article refers to: Playing with Alpine Linux (Part 4): Installing ZSH and Docker


Comments