Skip to content

Instantly share code, notes, and snippets.

Embed
What would you like to do?
Customization and Setup notes for Windows Terminal

Windows Terminal Notes

Installing

TIP: Pin the Terminal to your Taskbar for quick and easy access

Docs

Great docs here: https://docs.microsoft.com/en-us/windows/terminal/

Access Settings

Use the drop-down menu, or the Ctrl-, shortcut. Recommend VS Code or Notepad++ for editor.

Add a font

Recommendation: MesloLGS NS, but other code-oriented fonts probably also work great. https://github.com/romkatv/powerlevel10k#manual-font-installation

  1. Just download and open / install each ttf file.

  2. Then set the "fontFace" property in each "profile" in the Settings

{
    // Make changes here to the powershell.exe profile.
    "guid": "{61c54bbd-c2c6-5271-96e7-009a87ff44bf}",
    "name": "Windows PowerShell",
    "fontFace": "MesloLGS NF",
    "commandline": "powershell.exe",
    "hidden": false,
},
  1. Save the Settings.

Use a Color Scheme

Some included color schemes are avaialble upon install: https://docs.microsoft.com/en-us/windows/terminal/customize-settings/color-schemes#included-color-schemes For those schemes, you don't need to add the JSON for the scheme described in Step 2 below.

Lots of examples with screenshots and color values shown here: https://iterm2colorschemes.com/

Find JSON for the color schemes here: https://github.com/mbadolato/iTerm2-Color-Schemes/tree/master/windowsterminal

To use a color scheme:

  1. Open Settings for Windows Terminal (Settings menu or Ctrl-,)
  2. Add the JSON for any color schemes you might want to use in the "schemes" array.
"schemes": [
{
  "name": "Cobalt2",
  "black": "#000000",
  "red": "#ff0000",
  "green": "#38de21",
  "yellow": "#ffe50a",
  "blue": "#1460d2",
  "purple": "#ff005d",
  "cyan": "#00bbbb",
  "white": "#bbbbbb",
  "brightBlack": "#555555",
  "brightRed": "#f40e17",
  "brightGreen": "#3bd01d",
  "brightYellow": "#edc809",
  "brightBlue": "#5555ff",
  "brightPurple": "#ff55ff",
  "brightCyan": "#6ae3fa",
  "brightWhite": "#ffffff",
  "background": "#132738",
  "foreground": "#ffffff"
}
  1. Reference the name of the scheme as the "colorScheme" for the profile you want:
{
    "guid": "{61c54bbd-c2c6-5271-96e7-009a87ff44bf}",
    "name": "Windows PowerShell",
    "commandline": "powershell.exe",
    "fontFace": "MesloLGS NF",
    "padding": "20, 8, 8, 8",
    "fontSize": 11,
    "hidden": false,
    "colorScheme": "Cobalt2"
},
  1. Save the Settings file.

Customizing PowerShell - Use oh-my-posh!

Install oh-my-posh in some way (one shown below but others under the link):

winget install JanDeDobbeleer.OhMyPosh -s winget

Then run this command from a PowerShell prompt: Test-Path $profile

If it returns False, do this: New-Item -Type File -Force $profile

Then edit the profile notepad $profile

ALSO: From an elevated (administrator) Terminal window:

Set-ExecutionPolicy -Scope LocalMachine -ExecutionPolicy RemoteSigned
Install-Module posh-git -Scope CurrentUser
Install-Module Terminal-Icons -Scope CurrentUser

Example PowerShell Profile

You will see the custom-dracula-posh theme mentioned here -- options explained below.

##---------------------------------------
## Theming
##---------------------------------------
Import-Module -Name Terminal-Icons
oh-my-posh init pwsh --config ~/custom-dracula-posh.json | Invoke-Expression

## or more simply to use the default theme, omit the --config argument:  
## oh-my-posh init pwsh | Invoke-Expression

New-Alias npp "C:\Program Files (x86)\Notepad++\Notepad++.exe"

To get a list of all available themes (and see example prompts!!) use the following command:

Get-PoshThemes

Pick whichever one you like and replace ~/custom-dracula-posh.json above with something like "$env:POSH_THEMES_PATH/jandedobbeleer.omp.json" and make sure the theme name is before the .omp.json piece.

In case you're curious, my custom Dracula theme is based on the available Dracula theme but removes a couple of segments and includes Kubernetes context:

{
  "$schema": "https://raw.githubusercontent.com/JanDeDobbeleer/oh-my-posh/main/themes/schema.json",
  "blocks": [
    {
      "alignment": "left",
      "segments": [
        {
          "background": "#6272a4",
          "foreground": "#ffffff",
          "leading_diamond": "\ue0b6",
		  "trailing_diamond": "\ue0b0", 
          "style": "diamond",          
          "type": "os"          
        },
        {
          "background": "#bd93f9",
          "foreground": "#ffffff",
          "powerline_symbol": "\ue0b0",    
          "style": "powerline",          
		  "properties": {
			  "style": "folder"		  
		  },
          "type": "path"          
        },
        {
          "background": "#ffb86c",
          "foreground": "#ffffff",
          "powerline_symbol": "\ue0b0",
          "properties": {
            "branch_icon": "",
            "fetch_stash_count": true,
            "fetch_status": false,
            "fetch_upstream_icon": true
          },
          "style": "powerline",
          "template": " \u279c ({{ .UpstreamIcon }}{{ .HEAD }}{{ if gt .StashCount 0 }} \uf692 {{ .StashCount }}{{ end }}) ",
          "type": "git"
        },        
        {
          "background": "#ff79c6",
          "foreground": "#ffffff",
		  "powerline_symbol": "\ue0b0",    
          "style": "powerline",
          
          "type": "kubectl",
          "properties": {				
            "prefix": " \uF1D1 "
          }
        }
      ],
      "type": "prompt"
    }
  ],
  "final_space": true,
  "version": 2
}

PowerShell Theming Options

You can see the themes shown in images/screenshots here: https://ohmyposh.dev/docs/themes

See them in the Terminal with the Get-PoshThemes command.

@drazen-relias
Copy link

drazen-relias commented Aug 31, 2022

It seems that PowerShell Profile, as is, throws an error!? Any update on that?

@dahlsailrunner
Copy link
Author

dahlsailrunner commented Sep 1, 2022

You're right - I'll get this updated. Hopefully today. :)

@dahlsailrunner
Copy link
Author

dahlsailrunner commented Sep 1, 2022

Updated! Let me know if you have specific questions or issues @drazen-relias

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment