diff --git a/.conduit.yaml b/.conduit.yaml index 5cf9dd0..a56b2fe 100644 --- a/.conduit.yaml +++ b/.conduit.yaml @@ -10,6 +10,7 @@ - tmux - urlview - reattach-to-user-namespace + - osx-cpu-temp - pacman: - tmux - xclip diff --git a/system-info/system-info-macOS.sh b/system-info/system-info-macOS.sh index 5a6aca4..38ce9fb 100755 --- a/system-info/system-info-macOS.sh +++ b/system-info/system-info-macOS.sh @@ -12,8 +12,18 @@ 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. +ioreg -w0 -l | grep BatteryInstalled &> /dev/null && \ + has_battery=true || has_battery=false + while true; do - battery="`pmset -g batt | grep --color=never -Eo '\d+%'` ↯" - echo "$battery" > $cache_file + # Get the current CPU temperature. + cpu_temp="`/usr/local/bin/osx-cpu-temp`" + # Parse the current battery charge percentage. + $has_battery && \ + battery=" `pmset -g batt | grep --color=never -Eo '\d+%'` ↯" + # Write to the cache file. + echo "$cpu_temp$battery" > $cache_file + # Don't spin, sleep instead. sleep 2 done