/ scripts / sys_temp.sh
sys_temp.sh
 1  #!/usr/bin/env bash
 2  # setting the locale, some users have issues with different locales, this forces the correct one
 3  export LC_ALL=en_US.UTF-8
 4  
 5  get_temp() {
 6    if grep -q "Raspberry" /proc/device-tree/model 2>/dev/null; then
 7      # It's a Raspberry pi
 8      echo "$(vcgencmd measure_temp | sed 's/temp=//')"
 9    else
10      echo "$(sensors | grep 'Tctl' | awk '{print substr($2, 2)}')"
11    fi
12  }
13  
14  main() {
15    # storing the refresh rate in the variable RATE, default is 5
16    RATE=$(get_tmux_option "@dracula-refresh-rate" 5)
17    echo "$(get_temp)"
18    sleep $RATE
19  }
20  
21  # run main driver
22  main