Last active
February 14, 2024 17:16
-
-
Save CodeSigils/0e2d3240dbcd6fe15c6b16e47372264e to your computer and use it in GitHub Desktop.
Nerd fonts v2.1.0 installation script
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/bash | |
# | |
# DESC: Install Nerd fonts | |
# https://github.com/ryanoasis/nerd-fonts/ | |
# https://github.com/ryanoasis/nerd-fonts/releases/tag/v2.1.0 | |
# | |
## 1. Set prefered fonts version here | |
## base_url="https://github.com/ryanoasis/nerd-fonts/releases/download/v2.1.0/" | |
fonts_version="v2.1.0" | |
## 2. Set prefered fonts to be installed | |
nerd_fonts=( | |
'UbuntuMono' | |
'Ubuntu' | |
'AnonymousPro' | |
'FiraCode' | |
'FiraMono' | |
'Hack' | |
'Inconsolata' | |
'OpenDyslexic' | |
'Tinos' | |
'Ubuntu' | |
'SourceCodePro' | |
'LiberationMono' | |
'Meslo' | |
'Iosevka' | |
) | |
## 2. Set prefered local font directory here | |
local_font_path="${HOME}/.local/share/fonts" | |
reset=`tput sgr0` | |
red=`tput sgr0; tput setaf 1` | |
bRed=`tput bold; tput setaf 1` | |
rRed=`tput rev; tput setaf 1` | |
green=`tput sgr0; tput setaf 2` | |
bGreen=`tput bold; tput setaf 2` | |
rGreen=`tput rev; tput setaf 2` | |
#pkg_install curl curl | |
function install_nerd_font() { | |
font=$1 | |
base_url="https://github.com/ryanoasis/nerd-fonts/releases/download/{$fonts_version}/" | |
font_url="${base_url}${font}.zip" | |
font_path="${local_font_path}/${font}" | |
echo "${green}Installing font: ${bold}${font}${reset}" | |
if [ ! -d ${font_path} ] ; then | |
mkdir -p ${font_path} | |
curl -L ${font_url} -o "${font_path}/${font}.zip" | |
(yes | unzip "${font_path}/${font}.zip" -d ${font_path}) > /dev/null | |
rm "${font_path}/${font}.zip" | |
fc-cache | |
else | |
echo "${yellow}Skipping directory ${font_path} exists.${reset}" | |
fi | |
} | |
for i in "${nerd_fonts[@]}"; do | |
install_nerd_font "$i" | |
done | |
echo -e "\n Test: " | |
echo -e "\n${green}Your monospace font is:\n${bold}" \ | |
$(gsettings get org.gnome.desktop.interface monospace-font-name) \ | |
"\n${green}Be sure to change the setting of the terminal font ${reset}" |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment