mirror of
https://github.com/ohmyzsh/ohmyzsh.git
synced 2025-12-26 02:12:33 +01:00
10 lines
510 B
Bash
10 lines
510 B
Bash
if [[ $(acpi 2&>/dev/null | grep -c ^Battery) -gt 0 ]] ; then
|
|
function battery_pct_remaining() { echo "$(acpi | cut -f2 -d ',' | tr -cd '[:digit:]')" }
|
|
function battery_time_remaining() { echo $(acpi | cut -f3 -d ',') }
|
|
function battery_pct_prompt() { echo "%{$fg[red]%}[$(battery_pct_remaining)]%{$reset_color%}" }
|
|
else
|
|
error_msg='no battery'
|
|
function battery_pct_remaining() { echo $error_msg }
|
|
function battery_time_remaining() { echo $error_msg }
|
|
function battery_pct_prompt() { echo '' }
|
|
fi
|