Skip to content

Instantly share code, notes, and snippets.

Created December 29, 2012 03:54
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save anonymous/4404483 to your computer and use it in GitHub Desktop.
Save anonymous/4404483 to your computer and use it in GitHub Desktop.
Tmux-powerline smc temp mac
run_segment() {
__process_settings
#!/usr/bin/env bash
# Path to `smc` binary
smc="/Applications/smcFanControl.app/Contents/Resources/smc"
# Sensor to use. List is available at:
# https://github.com/hholtmann/smcFanControl/blob/master/smc-command/README#L74
sensor=TC0P
echo -n "∆ "
$smc -k $sensor -r | \
sed 's/.*bytes \(.*\))/\1/' | \
sed 's/\([0-9a-fA-F]*\)/0x\1/g' | \
perl -ne 'chomp; ($low,$high) = split(/ /); print "1k"; print (((hex($low)*256)+hex($high))/4/64); print " 1/n\n";' | \
dc
echo "°C"
}
__process_settings() {
temperature+=(["foreground"]="colour255")
temperature+=(["background"]="colour127")
temperature+=(["separator"]="${separator_left_bold}")
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment