sistema_progs

Programas para customizar o meu entorno de traballo nos meus equipos persoais
Log | Files | Refs

find_font_gnometerminal.sh (1554B)


      1 #!/usr/bin/env bash
      2 
      3 BASEDIR=$(dirname `readlink -f "$0"`)
      4 source ${BASEDIR}/../colors.sh
      5 
      6 if [ -n "$VERBOSE" ]; then
      7     echo -e "${CYAN}- GNOME TERMINAL:${NORMAL}"
      8 fi
      9 
     10 LIST_PROFILES=`dconf read /org/gnome/terminal/legacy/profiles:/list`
     11 LIST_PROFILES="${LIST_PROFILES:1:${#LIST_PROFILES}-2}"
     12 LIST_PROFILES=`echo $LIST_PROFILES | sed "s/, /\n/g" | sed -e "s/^'//" -e "s/'\$//"`
     13 
     14 IFS=' ' read -r -a LIST_PROFILES <<< $LIST_PROFILES
     15 for profile in "${LIST_PROFILES[@]}"; do
     16 
     17     NAME=`dconf read /org/gnome/terminal/legacy/profiles:/:$profile/visible-name`
     18     if [ -z "$FONT" ]; then
     19 	NAME="'Default'"
     20     fi
     21 
     22     USE_SYSTEM_FONT=`dconf read /org/gnome/terminal/legacy/profiles:/:$profile/use-system-font`
     23     FONT=`dconf read /org/gnome/terminal/legacy/profiles:/:$profile/font | sed -e "s/^'//" -e "s/'\$//" | rev | cut -d ' ' -f 2- | rev`
     24 
     25     if [ "$USE_SYSTEM_FONT" = "true" ]; then
     26 	FONT=`./find_font_system.sh`
     27 	if [ -z "$FONT" ]; then
     28 	    echo -e "${RED}ERROR: ${NORMAL}${0}:"
     29 	    echo "Fail to retrieve font system"
     30 	    echo "Please comment this issue: https://github.com/sebastiencs/icons-in-terminal/issues/1"
     31 	    echo "Use install.sh instead"
     32 	    exit 1
     33 	fi
     34     fi
     35 
     36     if [ -n "$VERBOSE" ]; then
     37        echo -e "    ${UNDERLINE}Profile: $NAME${NORMAL}"
     38 #       echo -e "   ${UNDERLINE}Profile: $NAME ($profile)${NORMAL}"
     39        echo -e "\tFont family:\t\t${GREEN}$FONT${NORMAL}"
     40        echo -e "\tUse system font:\t$USE_SYSTEM_FONT"
     41     else
     42 	echo "$FONT"
     43     fi
     44 done
     45 
     46 if [ ${#LIST_PROFILES[@]} -eq 0 ]; then
     47    echo "No font found"
     48 fi