fix(script): macos support
This commit is contained in:
parent
a469345663
commit
ed8f5726c8
|
@ -5,7 +5,7 @@
|
||||||
set -e
|
set -e
|
||||||
|
|
||||||
if [ "$(uname -s)" = "Darwin" ]; then
|
if [ "$(uname -s)" = "Darwin" ]; then
|
||||||
echo "" # TODO
|
pmset -g batt | tail -n 1 | grep -Eo "\d+%" | cut -d% -f1
|
||||||
else # Linux
|
else # Linux
|
||||||
cat /sys/class/power_supply/BAT0/capacity
|
cat /sys/class/power_supply/BAT0/capacity
|
||||||
fi
|
fi
|
||||||
|
|
|
@ -6,9 +6,9 @@ set -e
|
||||||
|
|
||||||
pc=$(batinfo)
|
pc=$(batinfo)
|
||||||
|
|
||||||
if [ "$pc" -gt 40 ]; then
|
if [[ "$pc" -gt 40 ]]; then
|
||||||
echo "#[fg=black, bg=green] $(batinfo)% #[default]"
|
echo "#[fg=black, bg=green] $(batinfo)% #[default]"
|
||||||
elif [ "$pc" -gt 10 ]; then
|
elif [[ "$pc" -gt 10 ]]; then
|
||||||
echo "#[fg=black, bg=yellow] $(batinfo)% #[default]"
|
echo "#[fg=black, bg=yellow] $(batinfo)% #[default]"
|
||||||
else
|
else
|
||||||
echo "#[fg=black, bg=red] $(batinfo)% #[default]"
|
echo "#[fg=black, bg=red] $(batinfo)% #[default]"
|
||||||
|
|
Loading…
Reference in New Issue