aboutsummaryrefslogtreecommitdiff
path: root/internal/p10k.zsh
diff options
context:
space:
mode:
authorromkatv <roman.perepelitsa@gmail.com>2019-06-16 13:31:07 +0300
committerromkatv <roman.perepelitsa@gmail.com>2019-06-16 13:31:07 +0300
commit9f05efb8e27f851b1c65056d41eca81b13fed63f (patch)
tree2b45207fa6c8ea9336ffb1ebffb3eb46107a8fe0 /internal/p10k.zsh
parent6a1f0659e6688d5483dbb48c367b55c2e0506e24 (diff)
fix properly round battery percent
Diffstat (limited to 'internal/p10k.zsh')
-rwxr-xr-xinternal/p10k.zsh4
1 files changed, 2 insertions, 2 deletions
diff --git a/internal/p10k.zsh b/internal/p10k.zsh
index d76233d1..79936c0d 100755
--- a/internal/p10k.zsh
+++ b/internal/p10k.zsh
@@ -464,7 +464,7 @@ prompt_battery() {
if _p9k_read_file $dir/(energy|charge)_now(N); then
(( energy_now += _P9K_RETVAL ))
elif _p9k_read_file $dir/capacity(N); then
- (( energy_now += _P9K_RETVAL * full / 100 ))
+ (( energy_now += _P9K_RETVAL * full / 100. + 0.5 ))
fi
_p9k_read_file $dir/status(N) && local bat_status=$_P9K_RETVAL || continue
[[ $bat_status != Full ]] && is_full=0
@@ -474,7 +474,7 @@ prompt_battery() {
(( energy_full )) || return
- bat_percent=$(( 100 * energy_now / energy_full ))
+ bat_percent=$(( 100. * energy_now / energy_full + 0.5 ))
(( bat_percent > 100 )) && bat_percent=100
if (( is_full || bat_percent == 100 )); then