improved battery status stuff
This commit is contained in:
parent
dbd4439f81
commit
335d15d24f
1 changed files with 35 additions and 10 deletions
|
@ -118,6 +118,33 @@ append_percent_icon() {
|
|||
segment_text="$segment_text$bgend%{O5}"
|
||||
}
|
||||
|
||||
append_battery_icon() {
|
||||
local pct=$1
|
||||
segment_text="$segment_text$bglight"
|
||||
if (( pct < 10 )); then
|
||||
segment_text="$segment_text"
|
||||
elif (( pct < 20 )); then
|
||||
segment_text="$segment_text"
|
||||
elif (( pct < 30 )); then
|
||||
segment_text="$segment_text"
|
||||
elif (( pct < 40 )); then
|
||||
segment_text="$segment_text"
|
||||
elif (( pct < 50 )); then
|
||||
segment_text="$segment_text"
|
||||
elif (( pct < 60 )); then
|
||||
segment_text="$segment_text"
|
||||
elif (( pct < 70 )); then
|
||||
segment_text="$segment_text"
|
||||
elif (( pct < 80 )); then
|
||||
segment_text="$segment_text"
|
||||
elif (( pct < 90 )); then
|
||||
segment_text="$segment_text"
|
||||
else
|
||||
segment_text="$segment_text"
|
||||
fi
|
||||
segment_text="$segment_text$bgend%{O5}"
|
||||
}
|
||||
|
||||
segment_tags() {
|
||||
local monitor=$1
|
||||
local tags
|
||||
|
@ -340,8 +367,6 @@ segment_battery() {
|
|||
# battery status (charging/charged/etc)
|
||||
batstat="$(upower --show-info $(upower --enumerate | grep -i 'BAT') | grep -E "state" | awk '{print $2}')"
|
||||
|
||||
baticon='B'
|
||||
|
||||
if (( battpct > 80 )); then
|
||||
batclass=$fggreen
|
||||
elif (( battpct < 20 )); then
|
||||
|
@ -350,17 +375,17 @@ segment_battery() {
|
|||
batclass=$fgblue
|
||||
fi
|
||||
|
||||
if [ "$batstat" = "fully-charged" ]; then
|
||||
baticon="${baticon}%{O3}⇈"
|
||||
elif [ "$batstat" = "discharging" ]; then
|
||||
baticon="${baticon}%{O3}↓";
|
||||
segment_text="$batclass"
|
||||
|
||||
if [ "$batstat" = "charging" ]; then
|
||||
segment_text="${segment_text}"
|
||||
elif [ "$batstat" = "fully-charged" ]; then
|
||||
segment_text="${segment_text}"
|
||||
else
|
||||
baticon="${baticon}%{O3}↑";
|
||||
append_battery_icon "$battpct"
|
||||
fi
|
||||
|
||||
segment_text="$batclass"
|
||||
append_percent_icon "$battpct"
|
||||
segment_text="$segment_text$baticon$fgend"
|
||||
segment_text="$segment_text$fgend"
|
||||
else
|
||||
segment_text="$fggreenﮣ$fgend"
|
||||
fi
|
||||
|
|
Loading…
Reference in a new issue