Slider

Install JetBrains Mono Font on Linux

Install JetBrains Mono Font on Linux
There are hundreds of fonts for IDEs and editors. The one that is pleasing to my eyes is JetBrains Mono. It is natural for a Java developer to find the default font of the IDE to be aesthetically pleasing to the eyes, but JetBrains Mono font looks nice in Sublime Text, VSCode, even the plain text editor and the terminal. The font is free, open-source, and designed with a developer-centric focus.

In 2020 when announcing the JetBrains Mono, the team mentioned what they have considered in designing the font:

While working on JetBrains Mono we focused, among other things, on the issues that can cause eye fatigue during long sessions of working with code. We have considered things like the size and shape of letters; the amount of space between them, a balance naturally engineered in monospace fonts; unnecessary details and unclear distinctions between symbols, such as I’s and l’s for example; and programming ligatures when developing our font.

JetBrains Mono is the default font in all IntelliJ products. However, this article provides a quick command to install and keep updating the font without visiting the official site or GitHub page of JetBrains Mono font.


Step 01:
Create a new script named jetbrains-mono.sh with the following code.

#!/bin/bash

repo="JetBrains"
name="JetBrainsMono"

get_latest_release() {
  curl --silent "https://api.github.com/repos/$1/releases/latest" | 
    grep '"tag_name":' | 
    sed -E 's/.*"([^"]+)".*/\1/'
}

# Define the latest url
version=$(get_latest_release "$repo/$name")
file_name="JetBrainsMono-${version:1}.zip"
url="https://github.com/$repo/$name/releases/download/$version/$file_name"


# Clear the existing folders
rm -rf /tmp/$file_name
rm -rf /tmp/fonts

# Download the zip
wget $url -P /tmp/

# Extract and install the fonts
unzip -o /tmp/$file_name -d /tmp/

# Install the fonts
if [ `id -u` = 0 ] ; then
  sudo mv /tmp/fonts /usr/share/fonts/JetBrainsMono
else
  mv /tmp/fonts ~/.local/share/fonts/JetBrainsMono
fi
fc-cache -f -v

# Clean the tmp dir
rm -rf /tmp/$file_name
rm -rf /tmp/fonts


Step 02:
Make the script executable.

chmod +x jetbrains-mono.sh


Step 03:

Run the script with sudo to install the font for all users or without sudo to install for the current user only. You can rerun this script whenever you want to upgrade the font with the latest version.
./jetbrains-mono.sh
sudo ./jetbrains-mono.sh

 

Instead of all these three steps, you can run the following command to download this script from our GitHub repository and run it straight away.

curl -s https://raw.githubusercontent.com/linuxedo/script-repo/main/font/jetbrains-mono.sh | bash -s


After installing JetBrains Mono, feel free to use the font in any of your favorite editors.

0

No comments

Post a Comment

disqus,linuxedo

DON'T MISS

News,DistroWar,HowTo
© all rights reserved
made with by templateszoo