install_fonts


"/home/yossef/notes/git/scripts/install_fonts.md"

path: git/scripts/install_fonts.md

- **fileName**: install_fonts
- **Created on**: 2025-03-26 14:49:21

for install some favourites fonts from nerd-fonts

#!/usr/bin/bash

RC='\e[0m'
RED='\e[31m'
YELLOW='\e[33m'
GREEN='\e[32m'

echo -e "${GREEN}----- running fonts script (; -----${RC}"
echo -e "${GREEN}----- enter the username for the user: ${RC}"
read username
FontsDir="/home/$username/.local/share/fonts"
mkdir -p ${FontsDir}

defaultFont="${FileMono}"
ChoosenFont="FileMono"
FiraMono="https://github.com/ryanoasis/nerd-fonts/releases/download/v3.2.1/FiraMono.zip"
D2Coding="https://github.com/ryanoasis/nerd-fonts/releases/download/v3.2.1/D2Coding.zip"
Noto="https://github.com/ryanoasis/nerd-fonts/releases/download/v3.2.1/Noto.zip"
CodeNewRoman="https://github.com/ryanoasis/nerd-fonts/releases/download/v3.2.1/CodeNewRoman.zip"
SpaceMono="https://github.com/ryanoasis/nerd-fonts/releases/download/v3.2.1/SpaceMono.zip"

checkFont() {

  echo -e "${GREEN} ----- welcome pls choose fonts: ------${RC}"
  echo -e "${GREEN} 1- FireMono -> default${RC}"
  echo -e "${GREEN} 2- D2Coding ${RC}"
  echo -e "${GREEN} 3- Note ${RC}"
  echo -e "${GREEN} 4- CodeNewRoman ${RC}"
  echo -e "${GREEN} 5- SpaceMono ${RC}"

  read option

  # check for option from user and download the font
  case "${option}" in
    1)
      wget "${FiraMono}"
      ;;
    2)
      ChoosenFont="D2Coding"
      wget "${D2Coding}" 
      ;;
    3)
      ChoosenFont="Note"
      wget "${Noto}" 
      ;;
    4)
      ChoosenFont="CodeNewRoman"
      wget "${CodeNewRoman}"  
      ;;
    5)
      ChoosenFont="SpaceMono"
      wget "${SpaceMono}" 
      ;;
    *) wget "${defaultFont}" ;;
  esac

  if [[ $? != 0 ]]; then
    echo -e "${RED}----- failed to download the font file -----${RC}"
    exit 1
  else
    echo -e "${GREEN}----- font file downloaded successfully -----${RC}"
    echo -e "${GREEN}----- moving the choosen ${ChoosenFont} to ${FontsDir} -----${RC}"
    mv "${ChoosenFont}.zip" ${FontsDir}
  fi

  if [[ $? != 0 ]]; then
    echo -e "${RED}----- failed to move the font file -----${RC}"
    exit 1
  else
    # starting get the download foudn and moving to chossing dir and extract
    echo -e "${GREEN}----- font file moved successfully -----${RC}"
    echo -e "${GREEN}----- unzipping the font file -----${RC}"
    unzip "${FontsDir}/${ChoosenFont}.zip" -d ${FontsDir}
    rm -rf "${FontsDir}/README.md" "${FontsDir}/Llicense.txt"
    echo -e "${GREEN} --- finish install --- ${RC}"
    #notify-send -u low -h string:urgency:success "Success" "success download ,install"
  fi
}

checkFont

continue:./install_java.md
before:./_install_dotfiles.md