Compare commits

..

1 Commits

Author SHA1 Message Date
0efee5882a Update system-info macOS user agent
Add CPU temperature to `status-info`, conditionally display battery
charge percentage, and documents the commands.
2021-02-17 20:44:34 +00:00

View File

@ -12,11 +12,17 @@ fi
trap '[ -f $cache_file ] && rm $cache_file; exit' INT
trap '[ -f $cache_file ] && rm $cache_file; exit' TERM
# Check if a battery is installed.
if ioreg -w0 -l|grep BatteryInstalled &> /dev/null; then
has_battery=true
else
has_battery=false
fi
while true; do
# Get the current CPU temperature.
cpu_temp="`/usr/local/bin/osx-cpu-temp`"
# Check if a battery is installed.
if ioreg -w0 -l|grep BatteryInstalled &> /dev/null; then
if $has_battery; then
# Parse the current battery charge percentage.
battery=" `pmset -g batt | grep --color=never -Eo '\d+%'` ↯"
fi