Change Font in Alacritty

Objective

Configure the Alacritty terminal emulator to use a custom font

Difficulty

Easy

Prerequisites

  • Install of Linux (I use arch: https://archlinux.org/)
  • xorg/Window Manager (I will use i3 for this example)
  • Alacritty Terminal Emulator
  • Text Editor (I use Micro, highly recommend for quick edits in the terminal)

Steps:

1. Choose a font you would like to use in terminal.

Inconsolata Nerd-Font

You can find examples of most fonts by searching for their name in a web browser. programmingfonts.org also lets you live preview many popular programing fonts.

to see all the fonts currently installed on your system, you can use fontconfig:

fc-list

Or if you want to check for one font in particular you can use:

fc-match NameOfFont -s

Where ‘NameOfFont’ is the font you’re checking for.

Notes:

  • Most distros provide packages pre-installed for popular fonts.
  • There are many fonts available as packages from official distro repositories.
  • If you are on Arch Linux, you can find lots of font packages on the AUR. (Including patched Nerd-Fonts)

2. Copy the Alacrity config file over.

When you install Alacritty it comes with a default config file in:

/usr/share/doc/alacritty/example/alacritty.yml

Alacritty will search a few different places for a custom config, but I recommend using:

$HOME/.config/alacritty/alacritty.yml

.config should already be created for your user. To double check you can do ‘cd .config’ from your home directory. Once you are there you can run :

(from ~/.config):

mkdir alacritty

to make the alacritty directory.

Now to copy over the default config file run:

cp /usr/share/doc/alacritty/example/alacritty.yml ~/.config/alacritty/ 

Notes:

  • ‘.config’ in a users home directory is usually the default place for config files and it prevents you from having to search all over the place to find them.

3. Edit the config file

I’m using the micro text editor, but use whichever editor you like to open it:

micro ~/.config/alacritty/alacritty.yml

You’ll want to scroll down in the file until you find the section marked ‘Font Configuration’

For me it starts on line 104

Everything is commented out right now. You need to un-comment the lines 105, 107, 114 and 117.

On 114 after ‘family:’ you want to replace ‘monospace’ with the name of the font you want to use.

If you forgot the name, open another terminal and run fc-match from step one. It should look like this:

Once you save the file the font should take effect depending on your window manager/Alacritty settings. If you don’t see the font change over:

  • Try restarting the terminal or window manager.
  • be sure that you used the correct font name.
  • Double check that your spacing is correct in the config, and that you didn’t make any typos. Alacritty is very picky about spacing and you may see an error that the file cannot be read if you use the wrong spacing.
Alacritty with ‘DaddyTimeMono’

Once the ‘Regular’ style is working you can repeat this process for the ‘Bold’ and ‘Italic’ sections.

Bold and Italic point to the same name

Notes

  • Most fonts have separate files for the bold and italic variations, or they will say ‘Complete’. Complete means that the bold and italic variations are contained in the same file, either way you can just repeat the same family name

[top] [home]