mirror of
https://github.com/ohmyzsh/ohmyzsh.git
synced 2026-01-09 02:24:03 +01:00
Zero pad minutes in battery time remaining
This commit is contained in:
parent
f80126fca5
commit
63f8146576
1 changed files with 2 additions and 1 deletions
|
|
@ -24,7 +24,8 @@ if [[ $(uname) == "Darwin" ]] ; then
|
|||
function battery_time_remaining() {
|
||||
if [[ $(ioreg -rc AppleSmartBattery | grep -c '^.*"ExternalConnected"\ =\ No') -eq 1 ]] ; then
|
||||
timeremaining=$(ioreg -rc "AppleSmartBattery"| grep '^.*"AvgTimeToEmpty"\ =\ ' | sed -e 's/^.*"AvgTimeToEmpty"\ =\ //')
|
||||
echo "~$((timeremaining / 60)):$((timeremaining % 60))"
|
||||
minutes="$((timeremaining % 60))"
|
||||
echo "~$((timeremaining / 60)):${(l:2::0:)minutes}"
|
||||
else
|
||||
echo "∞"
|
||||
fi
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue