Customize Your Windows Terminal #2020 - In-Depth

Customize Your Windows Terminal #2020 - In-Depth

·

11 min read

To all the developers out there who are already using the great windows terminal for development work. I'm sharing my customization to fall in love with your terminal and even boost your productivity while working. So without wasting any more time here is the final look of the Terminal after customization:

image.png

Here are the points below we will be covering in this article:

  1. Installing WSL
  2. Installing Windows Terminal
  3. Changing the shell from bash to zsh
  4. Installing Oh-my-zsh
  5. Installing Powerline10K
  6. Installing new powerline fonts
  7. Customizing windows terminal JSON settings

Introduction

Before using WSL I was using Linux distributions for development work but thanks to Microsoft for rolling out the WSL update for Windows as it solves many problems for developers who were using windows 10. But then why I switched from Linux to WSL, well there's a lot to it and I'm planning to cover that in my future posts.

So long strong short the default windows terminal is good but does not offer much out of the box, but it does have the potential of doing something much more.

So how is this article useful for the users investing their time in reading this. If you are a developer it will be very helpful to you but even if you are a normal user who is using WSL for some other work it will still be helpful as it offers a better style & shortcuts which will help you.

Installing WSL

  • This should be quick and easy. First, let us enable the feature using this PowerShell command: dism.exe /online /enable-feature /featurename:Microsoft-Windows-Subsystem-Linux /all /norestart

    NOTE: Just copy paste and run it as administrator and you are done with this step, also your windows 10 should be at least in version 1903 or higher

  • Next we enable the Virtual machine feature using this command: dism.exe /online /enable-feature /featurename:VirtualMachinePlatform /all /norestart
  • Download the Windows kernel package from here

  • Enter this command in PowerShell to make sure we use the latest wsl2 by default: wsl --set-default-version 2

  • The last step we download Ubuntu from the Windows store.

image.png

Installing Windows Terminal

Again, search for windows terminal by Microsoft and install it from the windows store.

image.png

Changing the shell from bash to zsh

In your windows terminal just ope ubuntu and type : sudo apt install zsh This will install the zsh shell and then use the command chsh -s $(which zsh) to switch to zsh permanently and logout and login back in.

Installing Oh-my-zsh

This is a very useful framework that does a lot for us to get started quickly. Use the below command to install it:

*sh -c "$(curl -fsSL https://raw.github.com/ohmyzsh/ohmyzsh/master/tools/install.sh)"*

Installing Powerline10K & fonts

Fonts:

Meslo LGS NF Regular

Meslo LGS NF Bold

Install these fonts by clicking on the file when download is done. For more fonts checkout:


**Installing Powerline10K**
Copy paste the below command to install it:

```git clone --depth=1 https://github.com/romkatv/powerlevel10k.git ${ZSH_CUSTOM:-$HOME/.oh-my-zsh/custom}/themes/powerlevel10k

Once the installation is done you need to set the zsh theme as powerlevel10k

ZSH_THEME="powerlevel10k/powerlevel10k" in ~/.zshrc

After this close and open the terminal and it will offer you a menu to select the customizations you would like to have.

image.png

image.png

Select rainbow by pressing 3. Then select :

  • Unicode
  • No
  • 4 Round
  • 1 Sharp
  • 1 One line
  • 2 Sparse
  • 2 Many icons
  • 2 Fluent
  • n No
  • 1 Verbose

Customizing windows terminal JSON settings

This is the final step and you may be thinking that your terminal does not look exactly like mine, or from where do I get the blue parrot so sit in my terminal, well I'm sharing my Github repo with the vscode settings file so just copy and paste the full file with yours and boom you are all done, just save and restart and it will look exactly like the one shown at the starting.

You can visit my Github repo and get the vscode settings or you can copy from below:

// This file was initially generated by Windows Terminal 1.2.2381.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": "{2c4de342-38b7-51cf-b940-2309a097f518}",
    // 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": {
            // Put settings here that you want to apply to all profiles.
            "useAcrylic": true,
            "acrylicOpacity": 0.7,
            "fontSize": 14,
            "colorScheme": "FirefoxDev"
        },
        "list": [
            {
                // Make changes here to the powershell.exe profile.
                "guid": "{61c54bbd-c2c6-5271-96e7-009a87ff44bf}",
                "name": "Windows PowerShell",
                "commandline": "powershell.exe",
                "hidden": false,
                "acrylicOpacity": 0.9,
                "closeOnExit": true,
                "colorScheme": "One Half Dark",
                "cursorColor": "#FFFFFF",
                "cursorShape": "bar",
                //"fontFace": "Meslo LG S for Powerline",
                "fontSize": 14,
                "padding": "0, 0, 0, 0",
                "snapOnInput": true,
                "useAcrylic": true,
                "backgroundImage": "https://images.unsplash.com/photo-1488767136043-c1eb91ca932d?ixlib=rb-1.2.1&ixid=eyJhcHBfaWQiOjEyMDd9&auto=format&fit=crop&w=1950&q=80",
                "backgroundImageOpacity": 0.8,
                "backgroundImageAlignment": "top",
                "backgroundImageStretchMode": "fill"
            },
            {
                // Make changes here to the cmd.exe profile.
                "guid": "{0caa0dad-35be-5f56-a8ff-afceeeaa6101}",
                "name": "Command Prompt",
                "commandline": "cmd.exe",
                "hidden": false,
                "backgroundImage": "https://images.unsplash.com/photo-1524368535928-5b5e00ddc76b?ixlib=rb-1.2.1&auto=format&fit=crop&w=1950&q=80",
                "backgroundImageOpacity": 0.5
            },
            {
                "guid": "{b453ae62-4e3d-5e58-b989-0a998ec441b8}",
                "hidden": false,
                "name": "Azure Cloud Shell",
                "source": "Windows.Terminal.Azure"
            },
            {
                "guid": "{2c4de342-38b7-51cf-b940-2309a097f518}",
                "hidden": false,
                "name": "Ubuntu 20.04",
                "source": "Windows.Terminal.Wsl",
                "closeOnExit": true,
                //"colorScheme": "Monokai Soda",
                "commandline": "wsl",
                "cursorColor": "#FFFFFF",
                "cursorHeight": 25,
                "fontFace": "MesloLGS NF",
                //"fontSize": 14,
                //"padding": "0, 0, 0, 0",
                "snapOnInput": true,
                "backgroundImage": "https://images.unsplash.com/photo-1506220926022-cc5c12acdb35?ixlib=rb-1.2.1&ixid=eyJhcHBfaWQiOjEyMDd9&auto=format&fit=crop&w=1950&q=80",
                "backgroundImageOpacity": 0.8,
                "backgroundImageAlignment": "top",
                "backgroundImageStretchMode": "uniformToFill",
                "tabTitle": "Ubuntu 20.04",
            }
        ]
    },
    // Add custom color schemes to this array.
    // To learn more about color schemes, visit https://aka.ms/terminal-color-schemes
    "schemes": [
        {
            "name": "xcad",
            "background": "#000000",
            "black": "#000000",
            "blue": "#6b6b6b",
            "brightBlack": "#5A6374",
            "brightBlue": "#9c9c9c",
            "brightCyan": "#56B6C2",
            "brightGreen": "#56e1f3",
            "brightPurple": "#C678DD",
            "brightRed": "#E06C75",
            "brightWhite": "#e2e2e2",
            "brightYellow": "#333333",
            "cyan": "#56B6C2",
            "foreground": "#e2e2e2",
            "green": "#56e1f3",
            "purple": "#C678DD",
            "red": "#E06C75",
            "white": "#e2e2e2",
            "yellow": "#56e1f3"
        },
        {
            "name": "Monokai Soda",
            "black": "#1a1a1a",
            "red": "#f4005f",
            "green": "#98e024",
            "yellow": "#fa8419",
            "blue": "#359ddf",
            "purple": "#f4005f",
            "cyan": "#58d1eb",
            "white": "#c4c5b5",
            "brightBlack": "#625e4c",
            "brightRed": "#f4005f",
            "brightGreen": "#98e024",
            "brightYellow": "#e0d561",
            "brightBlue": "#006fc0",
            "brightPurple": "#f4005f",
            "brightCyan": "#58d1eb",
            "brightWhite": "#f6f6ef",
            "background": "#1a1a1a",
            "foreground": "#c4c5b5"
        },
        {
            "background": "#282C34",
            "black": "#282C34",
            "blue": "#61AFEF",
            "brightBlack": "#5A6374",
            "brightBlue": "#61AFEF",
            "brightCyan": "#56B6C2",
            "brightGreen": "#98C379",
            "brightPurple": "#C678DD",
            "brightRed": "#E06C75",
            "brightWhite": "#DCDFE4",
            "brightYellow": "#E5C07B",
            "cyan": "#56B6C2",
            "foreground": "#DCDFE4",
            "green": "#98C379",
            "name": "One Half Dark",
            "purple": "#C678DD",
            "red": "#E06C75",
            "white": "#DCDFE4",
            "yellow": "#E5C07B"
        },
        {
            "background": "#073642",
            "black": "#073642",
            "blue": "#268BD2",
            "brightBlack": "#002B36",
            "brightBlue": "#839496",
            "brightCyan": "#93A1A1",
            "brightGreen": "#586E75",
            "brightPurple": "#6C71C4",
            "brightRed": "#CB4B16",
            "brightWhite": "#FDF6E3",
            "brightYellow": "#657B83",
            "cyan": "#2AA198",
            "foreground": "#FDF6E3",
            "green": "#859900",
            "name": "Solarized Dark",
            "purple": "#D33682",
            "red": "#D30102",
            "white": "#EEE8D5",
            "yellow": "#B58900"
        },
        {
            "name": "FirefoxDev",
            "black": "#002831",
            "red": "#e63853",
            "green": "#5eb83c",
            "yellow": "#a57706",
            "blue": "#359ddf",
            "purple": "#d75cff",
            "cyan": "#4b73a2",
            "white": "#dcdcdc",
            "brightBlack": "#625e4c",
            "brightRed": "#e1003f",
            "brightGreen": "#1d9000",
            "brightYellow": "#cd9409",
            "brightBlue": "#006fc0",
            "brightPurple": "#a200da",
            "brightCyan": "#005794",
            "brightWhite": "#e2e2e2",
            "background": "#0e1011",
            "foreground": "#7c8fa4"
        }
    ],
    // 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"
        }
    ]
}

Thanks for investing your time in this article, I hope this will be helpful to you guys. I will catch up with you in my next article :)