Skip to content

Instantly share code, notes, and snippets.

@izzqz
Last active August 11, 2026 18:59
Show Gist options
  • Select an option

  • Save izzqz/af36c5bbde67ffff0f7614cf738d75a5 to your computer and use it in GitHub Desktop.

Select an option

Save izzqz/af36c5bbde67ffff0f7614cf738d75a5 to your computer and use it in GitHub Desktop.
How to setup JetBrains Mono Nerd Font with ligatures to use is inside crostini terminal

Setup Nerd Fonts in Chrome OS terminal

Press Ctr + Shift + j to open devtools console in crostini terminal.

Paste this to use Jetbrais Mono with ligatures:

term_.prefs_.set('font-family', 'JetBrains Mono Nerd Font, monospace');
term_.prefs_.set('user-css-text', '@font-face {font-family: "JetBrains Mono Nerd Font"; src: url("https://raw.githubusercontent.com/ryanoasis/nerd-fonts/master/patched-fonts/JetBrainsMono/Ligatures/Regular/JetBrainsMonoNerdFont-Regular.ttf"); font-weight: normal; font-style: normal;} x-row {text-rendering: optimizeLegibility;font-variant-ligatures: normal;}')
  1. To change font, replace url path to raw .ttf file with your font in Nerd Fonts repository
  2. To disable ligatures, delete x-row class in user-css-text parameter
@mendsec

mendsec commented Sep 30, 2023

Copy link
Copy Markdown

Thanks for share @izzqz
But I'm having this problem.
image

Can you answer me any tip?

@izzqz

izzqz commented Oct 2, 2023

Copy link
Copy Markdown
Author

@izzqz

izzqz commented Oct 3, 2023

Copy link
Copy Markdown
Author

Also, this guide seems outdated for the latest version of chromeos. I can't open the console inside of it, and chrome-untrusted://terminal/ can't be opened in the browser. Looks like there is no way to use custom fonts... 😕

@wommy

wommy commented Nov 16, 2023

Copy link
Copy Markdown

ive been working on this myself for a few days now,
i just found this when searching, along with this post

i can get a few icons to show some of the time, but ive only been playing with it for 15 mins
i.e. works in tmux, but not in neovim, still investigating

@adm304

adm304 commented Nov 28, 2023

Copy link
Copy Markdown

Hey, i was trying to install it but it seems like the "term_ is not defined", may u help me please
Screenshot 2023-11-28 19 40 41

@izzqz

izzqz commented Nov 28, 2023

Copy link
Copy Markdown
Author

@adm304 Make sure you are using the console inside the terminal app itself. You can also find it here chrome-untrusted://terminal/html/terminal.html. If you're using the latest version of ChromeOS, unfortunately this won't work as you can't open the js console inside the terminal for now.

@d3vw

d3vw commented Dec 19, 2023

Copy link
Copy Markdown

Is there still a way to use Nerd fonts in the new version of Chrome OS?

@gbishop

gbishop commented Dec 23, 2023

Copy link
Copy Markdown

I've made some progress on this. First you can open the inspector by going to chrome://inspect/#other then use C-f to search for terminal.html. There will be 2 of them. You want the one with ?command. Click "inspect" and you'll be in the inspector. The next issue will be CORS.
I temporarily got around that by copying the .ttf into a directory being served on localhost.

It Worked!

@gbishop

gbishop commented Dec 23, 2023

Copy link
Copy Markdown

I've got it working on my Chromebook with an arcane series of hacks. Try it and let me know if it works for you.

https://gist.github.com/gbishop/9803b7ecc50b1930407ef4b98d1ba7c9

@gbishop

gbishop commented Jan 12, 2024

Copy link
Copy Markdown

I switched to Kitty terminal. Much better all round.

@izzqz

izzqz commented Jan 13, 2024

Copy link
Copy Markdown
Author

There's no need to tinker with an arcane series of hacks or open the inspect tool. Use Fontconfig. The Debian image comes preinstalled with all the fc-* tools. Just put your font files into ~/.local/share/fonts/ and setup the font config you want, globally or just for your linux user.

Currently AFAIK you can't use any fonts customization natively without development mode. So buying chromebook you are in powerline fonts jail. And you can use fonts only in linux apps inside crostini container, as you mention.

There's very old and staled Issue 320364 about font installation. Hopefully(hah), someone will bring it to life.

@vdegenne

Copy link
Copy Markdown

Please update your original comment, you left a ")" at the end of .ttf in your url... That's why It doesn't work.

@izzqz

izzqz commented Apr 10, 2025

Copy link
Copy Markdown
Author

@vdegenne Update it... Thanks 👍

@vdegenne

vdegenne commented Apr 23, 2025

Copy link
Copy Markdown

But just for information, I think this method is cleaner and will persist across the same account.

@edwinchenloo

Copy link
Copy Markdown

I have a modern chromebook and was able to do it by entering Ctrl-Shift-J to bring the developer console. Then enter:
"term_.prefs_.set(String.fromCharCode(117,115,101,114,45,99,115,115,45,116,101,120,116), String.fromCharCode(64,102,111,
110,116,45,102,97,99,101,32,123,32,102,111,110,116,45,102,97,109,105,108,121,58,32,39,72,97,99,107,32,78,101,114,100,32,
70,111,110,116,39,59,32,115,114,99,58,32,117,114,108,40,39,104,116,116,112,115,58,47,47,99,100,110,46,106,115,100,101,
108,105,118,114,46,110,101,116,47,103,104,47,114,121,97,110,111,97,115,105,115,47,110,101,114,100,45,102,111,110,116,115,
64,118,51,46,49,46,49,47,112,97,116,99,104,101,100,45,102,111,110,116,115,47,72,97,99,107,47,82,101,103,117,108,97,114,
47,72,97,99,107,78,101,114,100,70,111,110,116,45,82,101,103,117,108,97,114,46,116,116,102,39,41,32,102,111,114,109,97,
116,40,39,116,114,117,101,116,121,112,101,39,41,59,32,102,111,110,116,45,119,101,105,103,104,116,58,32,110,111,114,109,
97,108,59,32,102,111,110,116,45,115,116,121,108,101,58,32,110,111,114,109,97,108,59,32,125));"

to download nerdfont from github.com/ryanoasis/nerd-fonts/raw/master/patched-fonts/Hack/Regular/HackNerdFont-Regular.ttf

@kiwi-kiwi-kiwi

Copy link
Copy Markdown

But just for information, I think this method is cleaner and will persist across the same account.

That is the same method I have been using but my glyphs broke recently, and now the terminal/html/nassh_preferences_editor.html is returning a blank page. I think it has been deprecated?

This code worked for me in the ctrl + shift + j developer console (with the fonts I wanted)

term_.prefs_.set(
  "user-css-text", 
  '@font-face {font-family: "JetBrains Mono Nerd Font"; src: url("https://cdn.jsdelivr.net/gh/ryanoasis/nerd-fonts@v2.3.3/patched-fonts/JetBrainsMono/Ligatures/Regular/complete/JetBrains%20Mono%20Regular%20Nerd%20Font%20Complete.ttf"); font-weight: normal; font-style: normal;} x-row {text-rendering: optimizeLegibility;font-variant-ligatures: normal;}'
);

term_.prefs_.set(
  "font-family", 
  '"JetBrains Mono Nerd Font", monospace'
);

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