How to easily Customize Global Settings in Windows Terminal

In this blog post, we will discuss how to customize global settings in Windows Terminal. These settings are applicable at the terminal application level as well as all these settings override the profile settings.  If you are completely new to Windows Terminal, then I would highly recommend you to go through the introductory post of installing and understanding Windows Terminal. At the time of writing the current version of Windows Terminal is 1.0

Windows Terminal is a modern terminal application for users of command-line tools and shells like Command Prompt, PowerShell, and Windows Subsystem for Linux (WSL). Its main features include multiple tabs, panes, Unicode and UTF-8 character support, a GPU accelerated text rendering engine, and the ability to create your own themes and customize text, colors, backgrounds, and shortcut key bindings“. [source: Microsoft Docs]

Prerequisite

Global Settings in Windows Terminal – Configuration File

The best feature of Windows Terminal is the ability to customize it. The user can customize, its text color, cursor shape, background color, background image, opacity, icon settings, etc. The user can have multiple customized profiles and can have global settings to apply to all the available profiles as well. All these settings are stored in settings.json configuration files. Let us look into this file briefly.

settings.json

This file contains details about the default profiles, settings that can be applied to all available profiles, a list of available profiles, a place to declare custom color schemes and custom key bindings.

The settings.json file can be opened by using the shortcutCtrl + ,” or from the drop-down menu and select Settings

Global Settings in Windows Terminal
Global Settings in Windows Terminal – Open settings.json

The content of the settings.json file is given below, please note that your file will have the details based on your machine and the details might look a bit different then what is given below.

// This file was initially generated by Windows Terminal 1.0.1401.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-009a87ff44ba}",

  // 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.
    },
    "list": [
      {
        // Make changes here to the powershell.exe profile.
        "guid": "{61c54bbd-c2c6-5271-96e7-009a87ff44ba}",
        "name": "Windows PowerShell",
        "commandline": "powershell.exe",
        "hidden": false
      },
      {
        // Make changes here to the cmd.exe profile.
        "guid": "{0caa0dad-35be-5f56-a8ff-afceeeaa6102}",
        "name": "Command Prompt",
        "commandline": "cmd.exe",
        "hidden": false
      },
      {
        "guid": "{b453ae62-4e3d-5e58-b989-0a998ec441b9}",
        "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"
    }
  ]
}

Important Section to configure in Settings.json

The settings.json file contains a single object in which its properties can be divided into the following important sections, each of these sections is discussed in brief. Applying changes to this section reflects throughout the terminal application.

Generic Properties

These are the key-value pairs is at the settings.json root level, whose application is throughout the terminal application. Few of the important properties are discussed below:

Default Profile

To set the default profile using the following key-value pair. “defaultProfile:{GUID}”. The profile mentioned is set to default and is opened whenever we launch the Terminal application or open a new tab.

“defaultProfile”: “{61c54bbd-c2c6-5271-96e7-009a87ff44by}”,

Theme

There are three themes that can be applied to the terminal, dark, light, and system. If the system theme is applied the terminal uses the operating system level theme and this is the default value.

“theme”: “light”,

Global Settings in Windows Terminal - Light Theme
Global Settings in Windows Terminal -Light Theme Applied

Tab Settings

The tab allows the user to configure things like the text on the tab header, show tabs, tab width, and then close all tab group options. The available key-value pair for tab settings are given below:

For example, if you want to close all the opened tabs without confirmation you can place the following key-value pair.

“confirmCloseAllTabs”: true

keyvaluedefault description
alwaysShowTabstrue, falsetrueDisplays the tab on the UI
tabWidthModeequal, titleLength, compactcompactDisplay the tab width size as per configured value
confirmCloseAllTabstrue, falsetrueIf set to true, on closing the terminal, first confirm with user to close all opened tabs
Global Settings in Windows Terminal – Tab Settings

Terminal Launch Settings

The Terminal Launch settings provide customization that can be applied during the launch of the application. Configurations like, settings the size of the terminal, the Launch position of the application can be applied. Few of the available settings are as follows:

For example, if you want to open the Terminal application always in maximized mode, add the following key-value pair:

“launchMode”:”maximized”

keyvaluedefault description
launchModedefault, maximizeddefaultOpen the application in either default or maximized mode.

initialPosition
Coordinates in the following formats: “,” “#,#”, “#,”, “,#”“,”Open the application in the mentioned x, y coordinates.
initialColsInteger120Displays the number of characters columns when the application is launched.
initialRowsInteger30Displays the number of row when the application is launched.
Global Settings in Windows Terminal – Launch Settings

Title Bar Settings

There are two customizations that can be applied to Title Bar settings, the first one is you can either hide or show the title bar, and the second one is you can set the title to the text of the selected profile.

For example, if you want to hide the title bar you can apply the following key-value pair.

“showTabsInTitlebar”: false

key valuesdefaultdescription
showTabsInTitlebartrue, falsetrueThe title bar disappears and the tab are moved into the title bar
showTerminalTitleInTitlebartrue, falsetrueThe title bar displays the title of the selected tab.
Global Settings in Windows Terminal – Title Bar Settings

Selection Settings

The Selection Settings allows you to automate copy after any selection is made, copy the formatting in the clipboard as well as to delimit the word use while double-clicking any selected value.

For example, if you want to allow copy on select option add the following key-value pair in the settings.json root.

“copyOnSelect” : true

key valuesdefaultdescription
copyOnSelecttrue, falsefalseCopies the selected value to the clipboard.
copyFormattingtrue, falsefalseCopies the selected text along with its formatting into the clipboard
wordDelimitersCharacter string/\()”‘-:,.;<>~!@#$%^&*|+=[]{}~?│Delimits the word used in double-click selection
Global Settings in Windows Terminal – Selection Settings

Rendering Settings

The Rendering Settings helps to configure the rendering of the terminal application. There are two customizations that can be applied, first one is for Screen Redrawing when setting to true will redraw the entire screen for each frame and the second one in Software Rendering, when set to true the Terminal uses software rasterization to render the screen.

For example, if you want to enable software rasterization, use the following key-value pair.

“experimental.rendering.software”:true

key valuesdefaultdescription
experimental.rendering.forceFullRepainttrue, falsefalseEnable redrawing of entire screen for each frame
experimental.rendering.softwaretrue, falsefalseEnable the use of software rasterization
Global Settings in Windows Terminal – Rendering Settings

Scroll speed

The set the number of rows scrolled for a mouse wheel, use the following key-value pair. The default value is the system.

“rowsToScroll”:10

Windows Resize Behavior

With the help of snapToGridOnResize property, the user can either set the resizing of the terminal to either smooth resizing or snap to the nearest character. If you set the value to true, it will perform the latter else will do the smooth resizing.

“snapToGridOnResize”:true

Disable Dynamic Profile

If you would like to prevent Terminal from adding dynamic profiles during the startup of the application, you can use the “disabledProfileSources” key with the following possible values, Windows.Terminal.Wsl, Windows.Terminal.Azure, Windows.Terminal.PowershellCore

“disabledProfileSources”:[“Windows.Terminal.Wsl”]

Profiles

The profiles object array contains the list of all the profiles along with its settings. If the user wants to add a new profile along with its customization, he needs to do it here. The profile also has default settings that can be applied to all the profiles at once.

For example, if you want to set cursor shape to filled-box and set its color to red for all the profile, then the following will be applied to all the available profiles.

  "cursorShape": "filledBox",
  "cursorColor": "#FF0000"
Global Settings in Windows Terminal – Cursor Shape and Color

Schemes

The schemes array is the place to add all the custom color schemes. The same can be used in any selected profile. A good place to looks for various color scheme is here at GitHub: https://atomcorp.github.io/themes/

For example, I had added the following color schemed named “Custom Campbell” and I want to use it for my PowerShell profile, then I will add or modify the following key-value.

“colorScheme”: “Custom Campbell”

Keybindings

Keybindings is an array object where we define all the custom key-binding or shortcuts. We can modify an existing default key bindings here. For example, if we want to modify the key-bindings for “find” operation from default Ctrl+Shift+f to Ctrl+F, then we need to place the following key binding in the settings.json file.

 {
      "command": "find",
      "keys": "ctrl+f"
 },

Window Terminal is a great tool and can be customized as per your need, the terminal allows you to customize its color, background image, themes, cursor, tabs, panes, etc. If you want to customize further you can have a look at How to customize Windows Terminal Application post. All in all, it a great tool to manage different shells all in one place.

I hope you find the post on how to customize Global Settings in Windows Terminal helpful. Thanks for visiting, Cheers!!!

[Further Readings: How to add Git Bash to Windows Terminal Application |  How to customize Windows Terminal Application |  How to customize Windows Terminal Key Bindings |  How to Install Windows Terminal in Windows 10 |  Important Debugging Shortcuts of Visual Studio 2019 |  How to publish a Blazor Server Application to IIS |  Top 7 Visual Studio 2019 extensions for Web Projects |  The difference in Blazor Server and WebAssembly Application |  Exploring Blazor WebAssembly App Project Structure |  Top 10 Productivity Tips and Tricks in Visual Studio 2019 |  CRUD Operations in WPF using EntityFrameworkCore and SQLite |  How to implement Dependency Injection in WPF  ]  

0 0 votes
Article Rating
Subscribe
Notify of
guest
0 Comments
Inline Feedbacks
View all comments
0
Would love your thoughts, please comment.x
()
x