Skip to content

Instantly share code, notes, and snippets.

@markwragg
Last active February 27, 2024 14:38
  • Star 43 You must be signed in to star a gist
  • Fork 6 You must be signed in to fork a gist
Star You must be signed in to star a gist
Save markwragg/6301bfcd56ce86c3de2bd7e2f09a8839 to your computer and use it in GitHub Desktop.

How to get @DevBlackOps Terminal-Icons module working in PowerShell on Windows

Note: since version 0.1.1 of the module this now works in Windows PowerShell or PowerShell Core.

  1. Download and install this version of Literation Mono Nerd Font which has been specifically fixed to be recognised as monospace on Windows:

https://github.com/haasosaurus/nerd-fonts/blob/regen-mono-font-fix/patched-fonts/LiberationMono/complete/Literation%20Mono%20Nerd%20Font%20Complete%20Mono%20Windows%20Compatible.ttf

(see this issue for more info: ryanoasis/nerd-fonts#269)

  1. Modify the registry to add this to the list of fonts for terminal apps (cmd, powershell etc.):
$key = 'HKLM:\SOFTWARE\Microsoft\Windows NT\CurrentVersion\Console\TrueTypeFont'
Set-ItemProperty -Path $key -Name '000' -Value 'LiberationMono NF'
  1. Open PowerShell, right click the title bar > properties > Font > select your new font from the list.

  2. Install and load Terminal-Icons:

Install-Module Terminal-Icons -Scope CurrentUser
Import-Module Terminal-Icons

Result:

image

@weitzhandler
Copy link

Has anyone managed to make this work with Cascadia Code?

@VPraharsha03
Copy link

@weitzhandler isn't it fixed in 2.1 ?

@weitzhandler
Copy link

weitzhandler commented Nov 16, 2020

It's working now!
Here's the steps I took:

  1. Downloaded the fonts, unzipped it, and installed the Caskaydia* fonts
  2. Execute Install-Module Terminal-Icons -Scope CurrentUser
  3. Run code $profile, and appended the following line to it: Import-Module Terminal-Icons
  4. Added the following key under Computer\HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows NT\CurrentVersion\Console\TrueTypeFont: 000=CaskaydiaCove Nerd Font
  5. In Windows Terminal settings, under profiles>defaults, I set "fontFace": "CaskaydiaCove Nerd Font".

Result:

image

Sexy!

@snsnsjsn
Copy link

here is my successfully
1、download font https://github.com/ryanoasis/nerd-fonts/releases/download/v2.1.0/CascadiaCode.zip , unzip and install all Caskaydia Cove Nerd Font Complete.ttf
Caskaydia Cove Nerd Font Complete Mono Windows Compatible.ttf
Caskaydia Cove Nerd Font Complete Mono.ttf
Caskaydia Cove Nerd Font Complete Windows Compatible.ttf
image

2、Install-Module Terminal-Icons -Scope CurrentUser
image

3、notepad $profile
Import-Module posh-git
Import-Module oh-my-posh
Import-Module Terminal-Icons
Set-Theme Paradox
image

4、edit register
Computer\HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows NT\CurrentVersion\Console\TrueTypeFont
key: 000
value: CaskaydiaCove NF
image

5、open powershell
right click powershell left top icon , set font to CaskaydiaCove NF
image
6、 set windows terminal font to CaskaydiaCove NF
image

default font still Cascadia Code PL
image

now my windows terminal is beautiful to use
image

@VPraharsha03
Copy link

image
@snsnsjsn how did you configure powershell prompt (prompt{} function) to display those emojis ?

@0xBuro
Copy link

0xBuro commented Jan 5, 2021

image
@snsnsjsn how did you configure powershell prompt (prompt{} function) to display those emojis ?

You can tweak arround the Theme profile you are currently using.
I was not able to figure out a more 'clean' way to do this, but while the Terminal-Icons worked for me, the prompt icons set by the Theme itself showed as some weird hieroglyphs... well, expect the ones conversed from decimal code into a char type. So I did the same to the icons I wanted in my prompt:

  1. type $ThemeSettings in your Terminal to find out where your Theme is located at (mine is C:\$HOME\$USER\Documents\WindowsPowerShell\Modules\oh-my-posh\2.0.492\Themes\Material.psm1, since i set mine to Material)

  2. go to either your CurrentThemeLocation or MyThemeLocation - if you set up an individual Theme - and open your Theme in a editor

  3. find the decimal code or the html-entity of the Icon you want to use - for the latter just copy the numbers behind the characters. in my case it's 127833 for the rice ball icon. I used this website as my main source for the decimal codes: https://www.compart.com/en/unicode/U+1F359
    convertdecimal

  4. use your icons as chars conversed from decimal code in your ThemeName.psm1 (mine: Material.psm1) by declaring your desired icons like this:
    $DesiredIconName=([char]::ConvertFromUtf32(IconDecimalCode)), for 🍙 i.e: $RiceBall=([char]::ConvertFromUtf32(127833))

makeintochar

as you noticed it also works with zero width joiners (ZWJ) for the hacker cat! 🐱‍💻
you can now use your icon in desired places. In my Theme (Material) I used it like this $user = $RiceBall + ' ' + $sl.CurrentUser + " </>"
and replaced the 🏠 HomeSymbol with $sl.PromptSymbols.HomeSymbol = $HackerCat

Looks like this now

promptmoji

nicerice

@VPraharsha03
Copy link

VPraharsha03 commented Jan 6, 2021

@Burakbo Thank you for the very detailed answer. But i'm having trouble recognizing the emojis with the font i'm currently using.

Looks like a Powershell/CMD issue (microsoft/terminal#1503)

@VPraharsha03
Copy link

@Burakbo what is the version of PowerShell you are using ? I'm on 5.1.18362.752

@0xBuro
Copy link

0xBuro commented Jan 6, 2021

@Burakbo what is the version of PowerShell you are using ? I'm on 5.1.18362.752

5.1.19041.610
my profile default font is set as "fontFace": "FiraMono NF",

@VPraharsha03
Copy link

VPraharsha03 commented Jan 9, 2021

5.1.19041.610
my profile default font is set as "fontFace": "FiraMono NF",

Thanks a lot, FuraMono NF works well when tested in WT. For some reason, I'm unable to get new fonts to be recognized by cmd, powershell.

EDIT: I've tried patching some of the TTF fonts on my own and using OpenConsole over conhost, PL Glyphs are working but emojis are still missing (#190)

@BlackPauloBR
Copy link

A single font that works for me on PowerShell, Windows Terminal and VSCode with all the icons, is:
"Meslo LG M Regular Nerd Font Completely Mono Windows Compatible"

faceFont: "MesloLGM NF"

@erikmartinessanches
Copy link

erikmartinessanches commented Jan 6, 2023

It's working now! Here's the steps I took:

  1. Downloaded the fonts, unzipped it, and installed the Caskaydia* fonts
  2. Execute Install-Module Terminal-Icons -Scope CurrentUser
  3. Run code $profile, and appended the following line to it: Import-Module Terminal-Icons
  4. Added the following key under Computer\HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows NT\CurrentVersion\Console\TrueTypeFont: 000=CaskaydiaCove Nerd Font
  5. In Windows Terminal settings, under profiles>defaults, I set "fontFace": "CaskaydiaCove Nerd Font".

Result:

image

Sexy!

It worked for me without step 4, changing registry, but seemingly only if I did something like Set-ExecutionPolicy -ExecutionPolicy Unrestricted.

@Joel-Quintyn
Copy link

Do I have to use version 2.1.0 of the fonts?

@Bebotron
Copy link

It's working now! Here's the steps I took:

  1. Downloaded the fonts, unzipped it, and installed the Caskaydia* fonts
  2. Execute Install-Module Terminal-Icons -Scope CurrentUser
  3. Run code $profile, and appended the following line to it: Import-Module Terminal-Icons
  4. Added the following key under Computer\HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows NT\CurrentVersion\Console\TrueTypeFont: 000=CaskaydiaCove Nerd Font
  5. In Windows Terminal settings, under profiles>defaults, I set "fontFace": "CaskaydiaCove Nerd Font".

Result:

image

Sexy!

This doesn't work for me, some icons show up as boxes. Went down a huge rabbit hole of people having this issue on Windows, but haven't found a satisfying solution to get this working.

image

@Yufni
Copy link

Yufni commented Oct 3, 2023

My solution (I use Mononoki) was to use the full file path
Import-Module C:\Users\user_name\Documents\PowerShell\Modules\Terminal-Icons\0.11.0\Terminal-Icons.psm1

@plaiddk
Copy link

plaiddk commented Nov 14, 2023

Can anyone get it to work in pwsh 7.3.9 (Terminal) ? I cant even get it to show Icons. I followed all guides. Tried to change the regedit. Installed different Nerd Fonts.

Default profile in Windows Terminal is set to the Nerd font. Updated fonts to V3. OhMyPosh is showing perfectly fine. But I do not get one single icon for folder/files.

Any ideas?

@Yufni
Copy link

Yufni commented Nov 14, 2023

@plaiddk My solution (I use Mononoki) was to use the full file path
Import-Module C:\Users\user_name\Documents\PowerShell\Modules\Terminal-Icons\0.11.0\Terminal-Icons.psm1
I use pwsh 7.3.9 without problem

@plaiddk
Copy link

plaiddk commented Nov 14, 2023

@plaiddk My solution (I use Mononoki) was to use the full file path Import-Module C:\Users\user_name\Documents\PowerShell\Modules\Terminal-Icons\0.11.0\Terminal-Icons.psm1 I use pwsh 7.3.9 without problem

Thanks - I already tried this. Nothing happens. Just blank screen (No icons)

Screenshot_2

Update: I found out that i had no icons due too I had the module PSColor installed. When i Uninstalled the module it worked. So Uninstall-Module PSColor

@CheetahChrome
Copy link

CheetahChrome commented Nov 30, 2023

What worked for me was uninstalling Terminal via

winget uninstall Microsoft.WindowsTerminal

then in a normie powershell window, because Terminal magically goes away, I installed it

winget install Microsoft.WindowsTerminal

then in Terminal Settings->Defaults->Appearance is set to my font of choice

CaskaydiaCove Nerd Font

and started a new shell and I could see the directory icons.


My guess is at onetime I had the Terminal Preview installed or I am running on the Dev ring of Windows Update and something got horked.

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