Last active
November 3, 2020 07:59
-
-
Save ngsctt/49abba7fc4775211db5a7fd00049b1fe to your computer and use it in GitHub Desktop.
A BitBar (https://github.com/matryer/bitbar) plugin to get the current CPU proximity temperature using https://github.com/lavoiesl/osx-cpu-temp/. Based on https://github.com/matryer/bitbar-plugins/blob/master/System/cpu-temperature.5s.sh
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 | |
# <bitbar.title>CPU Temperature</bitbar.title> | |
# <bitbar.version>v1.0</bitbar.version> | |
# <bitbar.author>Nathan Scott</bitbar.author> | |
# <bitbar.author.github>ngsctt</bitbar.author.github> | |
# <bitbar.desc>This plugin displays the current CPU temperature, using osx-cpu-temp by @lavoiesl</bitbar.desc> | |
# <bitbar.dependencies>osx-cpu-temp</bitbar.dependencies> | |
# | |
# osx-cpu-temp can be downloaded from: https://github.com/lavoiesl/osx-cpu-temp | |
# One-liner: | |
# TEMPD=$(mktemp -d /tmp/osx-cpu-temp.XXXXXXXXXXXX) || exit 1 && (cd $TEMPD && curl -LO https://github.com/lavoiesl/osx-cpu-temp/archive/master.zip && unzip master.zip && (cd osx-cpu-temp-master && make && cp osx-cpu-temp /usr/local/bin/osx-cpu-temp)); rm -rf $TEMPD | |
TEMPERATURE_WARNING_LIMIT=80 | |
TEMPERATURE=($(/usr/local/bin/osx-cpu-temp)) | |
TEMP_VALUE=${TEMPERATURE[0]} | |
TEMP_INTEGER=${TEMPERATURE[0]%.*} | |
TEMP_UNIT=${TEMPERATURE[1]} | |
if [ "$TEMP_INTEGER" -gt "$TEMPERATURE_WARNING_LIMIT" ] ; then | |
ICON="🔥" | |
else | |
ICON="" | |
fi | |
echo "$ICON${TEMP_INTEGER}$TEMP_UNIT| size=12" |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment