#!/usr/bin/env bash . ~/bin/i3blocks/_utils # Get CPU temperature temp_cpu() { local cpu=$(expr $(cat /sys/class/thermal/thermal_zone1/temp) / 1000) if [[ $(echo "$cpu >= 60" | bc -l ) == "1" ]] && [[ $(echo "$cpu < 70" | bc -l ) == "1" ]]; then local bg=$warn1_bg local fg=$warn1_fg elif [[ $(echo "$cpu >= 70" | bc -l ) == "1" ]] && [[ $(echo "$cpu < 80" | bc -l ) == "1" ]]; then local bg=$warn2_bg local fg=$warn2_fg elif [[ $(echo "$cpu >= 80" | bc -l ) == "1" ]]; then local bg=$crit_bg local fg=$crit_fg fi local stat="CPU $cpu°C" if [[ -n "$bg" ]]; then echo -e "$stat\n" else echo -e "$stat\n" fi } temp_cpu