Update system-info macOS user agent
Add CPU temperature to `status-info`, conditionally display battery charge percentage, and documents the commands.
This commit is contained in:
parent
21a88edfaa
commit
67dc3dffaf
@ -10,6 +10,7 @@
|
|||||||
- tmux
|
- tmux
|
||||||
- urlview
|
- urlview
|
||||||
- reattach-to-user-namespace
|
- reattach-to-user-namespace
|
||||||
|
- osx-cpu-temp
|
||||||
- pacman:
|
- pacman:
|
||||||
- tmux
|
- tmux
|
||||||
- xclip
|
- xclip
|
||||||
|
@ -12,8 +12,18 @@ fi
|
|||||||
trap '[ -f $cache_file ] && rm $cache_file; exit' INT
|
trap '[ -f $cache_file ] && rm $cache_file; exit' INT
|
||||||
trap '[ -f $cache_file ] && rm $cache_file; exit' TERM
|
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
|
while true; do
|
||||||
|
# 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+%'` ↯"
|
battery=" `pmset -g batt | grep --color=never -Eo '\d+%'` ↯"
|
||||||
echo "$battery" > $cache_file
|
# Write to the cache file.
|
||||||
|
echo "$cpu_temp$battery" > $cache_file
|
||||||
|
# Don't spin, sleep instead.
|
||||||
sleep 2
|
sleep 2
|
||||||
done
|
done
|
||||||
|
Loading…
x
Reference in New Issue
Block a user