mirror of
https://github.com/ohmyzsh/ohmyzsh.git
synced 2026-04-17 04:29:14 +02:00
Fixed calculation for battery percentage
This commit is contained in:
parent
686e460258
commit
8c70000f25
1 changed files with 2 additions and 2 deletions
|
|
@ -136,7 +136,7 @@ function battery_level_gauge() {
|
||||||
local battery_remaining_percentage=$(battery_pct);
|
local battery_remaining_percentage=$(battery_pct);
|
||||||
|
|
||||||
if [[ $battery_remaining_percentage =~ [0-9]+ ]]; then
|
if [[ $battery_remaining_percentage =~ [0-9]+ ]]; then
|
||||||
local filled=$(((( $battery_remaining_percentage + $gauge_slots - 1) / $gauge_slots)));
|
local filled=$(((( $battery_remaining_percentage * $gauge_slots) / 100)));
|
||||||
local empty=$(($gauge_slots - $filled));
|
local empty=$(($gauge_slots - $filled));
|
||||||
|
|
||||||
if [[ $filled -gt $green_threshold ]]; then local gauge_color=$color_green;
|
if [[ $filled -gt $green_threshold ]]; then local gauge_color=$color_green;
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue