Skip to content

Seamless Windows Terminal Integration

David Refoua edited this page Jun 2, 2024 · 31 revisions

Introduction

🖥 Windows Terminal is a modern, feature-rich, productive terminal emulator for Windows by Microsoft. It comes pre-installed on Windows 11, and can also be installed on Windows 10.

Some of the features include multiple tabs, panes, Unicode and UTF-8 character support, a GPU-accelerated text rendering engine, and custom themes, styles, and configurations.

It has support for font ligatures, colorful emojis, and a cool blurred-behind background.

Here's a demo of Windows Terminal with Cmder:

Cmder on Windows Terminal

Note:

  • If you want to replicate the above screenshot with the exact settings, you can use the settings.json file from here: 📦 TerminalSettings.zip.

  • Also, you need to download the latest Agave-Regular.ttf font from here: 📜agave.ttf

  • The default color palette in the above screenshot is 🖌️ OneHalf Dark, which is included in the settings.json file and already set as default.

Alternatively, follow the instructions below to add Cmder as the shell profile:

 

Instructions

  1. If not already installed, locate the Windows Terminal from the Microsoft store and install it: download page
    👉 Note: Windows 11 comes with Windows Terminal already pre-installed.

  2. Follow the instructions in this page to set up the %CMDER_ROOT% environmental variable.
    ✍ Tip: If you already have a working environment variable, skip this step.

  3. Open Windows Terminal, then press ⌨️ Ctrl + , (Control-Comma) to open the Settings file ⚙️ (settings.json).
    If you see the GUI settings page, from the left side click on the ⚙ icon at the bottom of the sidebar.

    The settings file will be opened in your default text editor program for editing.

  4. Navigate to profiles section and add the following profile to the list attribute. You can place it at the top if you want Cmder to be the first item in the dropdown selection window.

            {
                "guid": "{00000000-0000-0000-ba54-000000000132}",
                "commandline": "cmd.exe /k \"%cmder_root%/vendor/init.bat\"",
                "icon": "%cmder_root%/icons/cmder.ico",
                "name": "Cmder", // You can give a custom name here
                "closeOnExit": "graceful",
                "hidden": false
            },

    👉 Note: Make sure to define the environment variable before using the %CMDER_ROOT% portion.

  5. Additional configuration

    • You can make Cmder the default shell-environment/profile by changing the defaultProfile attribute in the settings file to the name of Cmder's profile (i.e. cmder) in the settings file. For example, if the name of the Cmder profile is cmder, change defaultProfile value to:

        "defaultProfile": "cmder",

     

    • You can specify a starting directory. The default starting directory is C:\Users\username\, i.e. the home directory. You can set it to anything you want by making the following changes:

          {     
                "guid": "{00000000-0000-0000-ba54-000000000132}",
                "commandline": "cmd.exe /k \"%cmder_root%/vendor/init.bat\"",
                "startingDirectory": "E:/Codes/", // Specify your directory of choice
                "name": "Cmder",
                "icon": "%cmder_root%/icons/cmder.ico",
                "hidden": false
          },

     

    • You can also add the Monokai-Cmder color scheme into Terminal's "schemes": []
      (source: https://atomcorp.github.io/themes/?theme=Monokai+Cmder)

        {
            "name": "Monokai Cmder",
            "black": "#272822",
            "red": "#a70334",
            "green": "#74aa04",
            "yellow": "#b6b649",
            "blue": "#01549e",
            "purple": "#89569c",
            "cyan": "#1a83a6",
            "white": "#cacaca",
            "brightBlack": "#7c7c7c",
            "brightRed": "#f3044b",
            "brightGreen": "#8dd006",
            "brightYellow": "#cccc81",
            "brightBlue": "#0383f5",
            "brightPurple": "#a87db8",
            "brightCyan": "#58c2e5",
            "brightWhite": "#ffffff",
            "background": "#272822",
            "foreground": "#cacaca",
            "selectionBackground": "#cccc81",
            "cursorColor": "#ffffff"
        },

      After that, modify the Cmder profile with "colorScheme": "Monokai Cmder", like this:

        {
            "guid": "{00000000-0000-0000-ba54-000000000132}",
            "commandline": "cmd.exe /k \"%cmder_root%/vendor/init.bat\"",
            "colorScheme": "Monokai Cmder", // Set the color scheme to "Monokai Cmder"
            "icon": "%cmder_root%/icons/cmder.ico",
            "name": "Cmder",
            "closeOnExit": "graceful",
            "hidden": false
        },

      Monokai Cmder on Windows Terminal

     

    • To use Powershell instead of the default clink shell, use the following values:

          {     
                "guid": "{00000000-0000-0000-ba54-000000000127}",
                "name": "Cmder :: Powershell",
                "commandline": "%SystemRoot%/System32/WindowsPowerShell/v1.0/powershell.exe -ExecutionPolicy Bypass -NoLogo -NoProfile -NoExit -Command \"Invoke-Expression '. ''%cmder_root%/vendor/profile.ps1'''\"",
                "icon": "%cmder_root%/icons/cmder.ico",
                "colorScheme": "Monokai Cmder",
                "hidden": false
          },
  6. Configure the prompt colors: In order to change the prompt colors, modify the following file:

    %cmder_root%\config\cmder_prompt_config.lua
    
    uah_color = "\x1b[1;33;49m" -- Green = uah = [user]@[hostname]
    cwd_color = "\x1b[1;32;49m" -- Yellow cwd = Current Working Directory
    lamb_color = "\x1b[1;30;49m" -- Light Grey = Lambda Color
    clean_color = "\x1b[1;37;49m"
    dirty_color = "\x1b[33;3m"
    conflict_color = "\x1b[31;1m"
    unknown_color = "\x1b[37;1m" -- White = No VCS Status Branch Color

    For more customizations, please see Customization.

    👉 Note: The previous default prompt colors might produce an ugly black background in your acrylic theme, such as below:
    This was due to use of SGR40 color code instead of SGR49 as in the provided config above. Using the values provided above will fix the issue.

Optional Steps

Default terminal application

If you're on Windows 11, you can set Microsoft Terminal as the default Terminal app on windows, so even if you type cmd.exe in the run menu, the new terminal app will open instead (reference).

Then, together with the Default profile option set to Cmder, you can get the option to launch Cmder instead of Command Prompt in a more modern and safe way.

  1. Press Ctrl + , (Control-Comma) to access Terminal Settings
  2. Set the Default terminal application to Windows Terminal
  3. Click Save

With this mechanism, you can take use of the Win + X keys to open the terminal quickly.

Atom OneDark Scheme

You can set the default profile values to have a better-looking color scheme, such as OneHalfDark and optionally with the agave monospace font:

        "defaults":
        {
            "closeOnExit": "never",
            "colorScheme": "OneHalfDark",
            "cursorColor": "#FFFFFF",
            "cursorShape": "vintage",
            "font":
            {
                "face": "agave",
                "size": 12
            },
            "historySize": 9001,
            "opacity": 90,
            "padding": "4, 4, 4, 4",
            "snapOnInput": true,
            "startingDirectory": "%USERPROFILE%",
            "useAcrylic": true
        },
        {
            "background": "#282C34",
            "black": "#5A6374",
            "blue": "#61AFEF",
            "brightBlack": "#5A6374",
            "brightBlue": "#61AFEF",
            "brightCyan": "#56B6C2",
            "brightGreen": "#98C379",
            "brightPurple": "#C678DD",
            "brightRed": "#E06C75",
            "brightWhite": "#DCDFE4",
            "brightYellow": "#E5C07B",
            "cursorColor": "#FFFFFF",
            "cyan": "#56B6C2",
            "foreground": "#DCDFE4",
            "green": "#98C379",
            "name": "OneHalfDark",
            "purple": "#C678DD",
            "red": "#E06C75",
            "selectionBackground": "#FFFFFF",
            "white": "#DCDFE4",
            "yellow": "#E5C07B"
        },

This guide was developed initially from issue #2121

More information:

Demo

Windows Terminal Cmder

Default Cmder (with ConEmu)