Skip to content

Instantly share code, notes, and snippets.

Show Gist options
  • Star 19 You must be signed in to star a gist
  • Fork 3 You must be signed in to fork a gist
  • Save diffficult/8354813bf536339a218ef1b51c5d9e98 to your computer and use it in GitHub Desktop.
Save diffficult/8354813bf536339a218ef1b51c5d9e98 to your computer and use it in GitHub Desktop.
Customize your ChromeOS fonts - working April 2017

Customize Chromebook Chrosh Shell Environment

Requirement: Chromebook, Common Sense, Commandline Ablity, 1 hour of time

Dear developers with a spare Chromebook lets inject a little personalization into your Crosh shell with custom fonts, the solarized theme, and extra secure shell options.

Also, keep in mind that the terms Chrosh, Chrosh Window, and Secure Shell all refer to various versions and extentions built around the ChromeOS terminal. Settings that affect the ChromeOS terminal are global.

Custom Fonts

Adding fonts would is as easy as dropping a font file into the .fonts folder and changing a terminal setting. Sadly, we need to do a bit of work to get custom fonts working with ChromeOS.

Creating a proper .fonts.conf

Chromebook must be in developer mode. Once this is done, extra fonts can be added to ChromeOS's font folder located in /usr/local/share/fonts.

  1. Create a file (ex. font.conf) on your Download folder on ChromeOS, use your favourite editor and copy the next bit into it and save. This will tell ChromeOS where to get the extra fonts that we will install later on.
<?xml version="1.0"?>
<!DOCTYPE fontconfig SYSTEM "fonts.dtd">
<fontconfig>
        <dir>/usr/local/share/fonts</dir>
</fontconfig>
  1. Fire up the Crosh shell with ctrl+alt+t

  2. Get to your Download folder and copy your newly created font config file to /home/chronos/user. Just cp fon.config /home/chronos/user/.font.conf

  3. Now you only need to download and copy any fonts (.ttf or .otf) into /usr/local/share/fonts. Just in case check that there's already a directory named fonts if there isn't any just create it mkdir /usr/local/share/fonts.

  4. After you finished copying your font files just reboot your Chromebook. Newly fonts should appear in the droplist for the font selection and should be available to any app that it's running on ChromeOS including crosh.

Tip: there's a chance ChromeOS is not displaying the newly added fonts, you can induce a desktop crash and reload using chrome://inducebrowsercrashforrealz to quickly reload without rebooting and checking if the fonts are working.

Installing Powerline Fonts

Fonts in .ttf format can be installed to the folder /usr/local/share/fonts/

Installing either the normal or powerline patched versions of your favorite monospaced fonts to the aforementioned folder is required for proper configuration of the font family settings in Secure Shell a bit latter.

https://github.com/Lokaltog/powerline-fonts

Add Required Chrome Extentions

To further customize our Crosh window, install both Secure Shell and the Crosh Window extentions from the Chrome Web Store.

Set Up Chrosh's Font-Family and Font-Size

ChromeOS apps menu > right click on the Secure Shell icon > select options

Change the terminal settings as you see fit. Pay special attention to:

font-family

Keep in mind ChromeOS will only load the first avaliable font that you specified in the font-family field's comma-separated list. If you wan to use a custom font make sure you add it as the first entry. To get the name of the font you want to use, refer to the 'Powerline Font Family' column in the table on this page. For example, if you want to use Ubuntu Mono, add "Ubuntu Mono derivative Powerline", to the front of the 'font-family' field.

font-size

Since most(possibly all) powerline fonts are slighly smaller than default font, you may wish to bump the size up from 15 to a modestly larger 16 or 17.

base16

Base16 is a wonderland of beauty for your terminal.

It's a bit tricky to set up properly on the Chromebook. This page has instructions on setting up base16 for Crosh and making the colors work with vim + tmux inside your chroot.

Solarized Color Theme

It's almost criminal how easy it is to install solarized for Crosh.

I'm including the code for the prefs.js file I used for convenience.

// Disable bold 
term_.prefs_.set('enable-bold', false) 

// Use this for Solarized Dark 
term_.prefs_.set('background-color', "#002b36");
term_.prefs_.set('foreground-color', "#839496");

// Solarized Colors
term_.prefs_.set('color-palette-overrides', [
  '#073642', 
  '#dc322f', 
  '#859900', 
  '#b58900', 
  '#268bd2', 
  '#d33682', 
  '#2aa198', 
  '#eee8d5', 
  '#002b36', 
  '#cb4b16', 
  '#586e75', 
  '#657b83', 
  '#839496', 
  '#6c71c4', 
  '#93a1a1', 
  '#fdf6e3'
]);
  • Open the Chrome Javascript Console ctrl+shift+j
  • Paste the contents of your solarized prefs.js file into the console
  • Hit enter

Further Customizations

Loading a Crosh Window based Ubuntu 14.04 Chroot is the best way to make use of the customizations.

For powerline patched font use in vim:

  • add bling/vim-airline to vim
  • edit your .vimrc to include let g:airline_powerline_fonts = 1

For powerline patched font use in tmux:

  • Install ZSH shell, oh-my-zsh, and set the zsh-theme to agnoster

That's it

This instructions are possible thanks to https://gist.github.com/aaronhalford and the guys at https://bugs.chromium.org/p/chromium/issues/detail?id=320364. Thanks for reading!

@dbaynard
Copy link

I had to use a bind mount to get .fonts.conf picked up

@guilala
Copy link

guilala commented Apr 2, 2018

The bind method is broken as of Chrome OS Dev 67.0.3381.0. The mounted user folder /tmp/test/user is now empty, and putting a .fonts.config file here is persistent, but doesn't get mapped with the chronos home folder. The only way i get a custom font in Crosh now, is after a chrome://inducebrowsercrashforrealz :-/...

@loonymike
Copy link

Hello this is great. How can I make the default shell window larger when initially launched? Thanks,

@gheber05
Copy link

gheber05 commented Dec 3, 2018

umm.. how do you do this if you cant change your Chromebook to Developer mode? I cant change it cuz my school made it so I cant change it.

@JL2210
Copy link

JL2210 commented May 30, 2019

@gheber05 You can't.

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