Update atomic.theme.bash

- Reverted Battery Segment to the original.
- Now the segment is the same for all operating systems.
- Battery Plugin control segment battery in theme.
- I have cleaned and organized the code 😃
pull/968/head
Luis Felipe Sánchez 2017-05-25 23:43:18 -05:00 committed by GitHub
parent 176cf00f6c
commit 6e1477a8aa
1 changed files with 170 additions and 234 deletions

View File

@ -9,12 +9,9 @@
IRed="\e[1;49;31m"
IGreen="\e[1;49;32m"
IYellow="\e[1;49;33m"
ICyan="\e[1;49;36m"
IWhite="\e[1;49;37m"
White="\e[0;49;37m"
BIWhite="\e[1;49;37m"
BICyan="\e[1;49;36m"
ResetColor="\e[0;49;37m"
#############
## Symbols ##
@ -166,48 +163,7 @@ ___atomic_prompt_clock() {
printf "%s|%s|%s|%s" "${color}" "${info}" "${bold_white}" "${box}"
}
case "$OSTYPE" in
cygwin*) ___atomic_prompt_battery() {
[ "${THEME_SHOW_BATTERY}" != "true" ] && return
batp=$(echo porcent=$(WMIC PATH Win32_Battery Get EstimatedChargeRemaining /Format:List) | grep -o '[0-9]*')
bats=$(echo porcent=$(WMIC Path Win32_Battery Get BatteryStatus /Format:List) | grep -o '[0-9]*')
if [ "$batp" -gt 50 ]; then
color=$bold_green
elif [ "$batp" -lt 50 ] && [ "$batp" -gt 25 ]; then
color=$bold_yellow
elif [ "$batp" -lt 25 ]; then
color=$IRed
fi
box="[|]"
[ "$bats" -eq 1 ] && info="-"
[ "$bats" -eq 2 ] && info="+"
info+=$batp
[ "$info" == "+100" ] && info="AC"
printf "%s|%s|%s|%s" "${color}" "${info}" "${bold_white}" "${box}"
} ;;
msys*) ___atomic_prompt_battery() {
[ "${THEME_SHOW_BATTERY}" != "true" ] && return
batp=$(echo porcent=$(WMIC PATH Win32_Battery Get EstimatedChargeRemaining /Format:List) | grep -o '[0-9]*')
bats=$(echo porcent=$(WMIC Path Win32_Battery Get BatteryStatus /Format:List) | grep -o '[0-9]*')
if [ "$batp" -gt 50 ]; then
color=$bold_green
elif [ "$batp" -lt 50 ] && [ "$batp" -gt 25 ]; then
color=$bold_yellow
elif [ "$batp" -lt 25 ]; then
color=$IRed
fi
box="[|]"
[ "$bats" -eq 1 ] && info="-"
[ "$bats" -eq 2 ] && info="+"
info+=$batp
[ "$info" == "+100" ] && info="AC"
printf "%s|%s|%s|%s" "${color}" "${info}" "${bold_white}" "${box}"
} ;;
darwin*) ___atomic_prompt_battery() {
___atomic_prompt_battery() {
[ ! -e "$BASH_IT"/plugins/enabled/battery.plugin.bash ] ||
[ "${THEME_SHOW_BATTERY}" != "true" ] && return
batp=$(battery_percentage)
@ -224,27 +180,7 @@ case "$OSTYPE" in
info+=$batp
[ "$info" == "+100" ] && info="AC"
printf "%s|%s|%s|%s" "${color}" "${info}" "${bold_white}" "${box}"
} ;;
linux*) ___atomic_prompt_battery() {
[ ! -e "$BASH_IT"/plugins/enabled/battery.plugin.bash ] ||
[ "${THEME_SHOW_BATTERY}" != "true" ] && return
batp=$(battery_percentage)
if [ "$batp" -gt 50 ]; then
color=$bold_green
elif [ "$batp" -lt 50 ] && [ "$batp" -gt 25 ]; then
color=$bold_yellow
elif [ "$batp" -lt 25 ]; then
color=$IRed
fi
box="[|]"
ac_adapter_disconnected && info="-"
ac_adapter_connected && info="+"
info+=$batp
[ "$info" == "+100" ] && info="AC"
printf "%s|%s|%s|%s" "${color}" "${info}" "${bold_white}" "${box}"
} ;;
*) echo "bt:" ;;
esac
}
___atomic_prompt_exitcode() {
[ "${THEME_SHOW_EXITCODE}" != "true" ] && return