mirror of
https://github.com/ohmyzsh/ohmyzsh.git
synced 2026-04-10 04:26:17 +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
|
|
@ -91,7 +91,7 @@ elif [[ $(uname) == "Linux" ]] ; then
|
|||
}
|
||||
|
||||
function battery_pct_prompt() {
|
||||
b=$(battery_pct_remaining)
|
||||
b=$(battery_pct_remaining)
|
||||
if [[ $(acpi 2&>/dev/null | grep -c '^Battery.*Discharging') -gt 0 ]] ; then
|
||||
if [ $b -gt 50 ] ; then
|
||||
color='green'
|
||||
|
|
@ -136,7 +136,7 @@ function battery_level_gauge() {
|
|||
local battery_remaining_percentage=$(battery_pct);
|
||||
|
||||
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));
|
||||
|
||||
if [[ $filled -gt $green_threshold ]]; then local gauge_color=$color_green;
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue