1
0
Fork 0
mirror of synced 2024-12-21 22:31:06 -05:00

pimped the battery indicator with a gradient palette

This commit is contained in:
Gregory Pakosz 2015-09-14 21:17:06 +02:00
parent db80cb7fc4
commit 81b6897294
2 changed files with 11 additions and 6 deletions

View file

@ -380,19 +380,22 @@ run 'for name in $(printenv | grep -Eo ^tmux_conf_[^=]+); do tmux setenv -gu $na
# [ $empty -gt 0 ] && \
# printf '#[fg=%s,bg=%s]' $battery_empty_fg $battery_bg && \
# printf "%0.s$battery_symbol_empty" $(seq 1 $empty)
# elif echo $battery_palette | grep -q -E '^heat(,colour[0-9]{1,3})?$'; then
# elif echo $battery_palette | grep -q -E '^heat|gradient(,colour[0-9]{1,3})?$'; then
# battery_style=$(echo $battery_palette | cut -d, -f1)
# battery_bg=$(echo $battery_palette | cut -s -d, -f2)
# battery_bg=${battery_bg:-colour16}
# gradient="196 202 208 214 220 226 190 154 118 82 46"
# heat="233 234 235 237 239 241 243 245 247 144 143 142 184 214 208 202 196"
# heat_count=$(echo $(echo $heat | wc -w))
# eval palette=$(echo \$$battery_style)
# count=$(echo $(echo $palette | wc -w))
#
# eval set -- "$heat"
# heat=$(eval echo $(eval echo $(printf "\\$\{\$(expr %s \* $heat_count / $battery_symbol_count)\} " $(seq 1 $battery_symbol_count))))
# eval set -- "$palette"
# palette=$(eval echo $(eval echo $(printf "\\$\{\$(expr %s \* $count / $battery_symbol_count)\} " $(seq 1 $battery_symbol_count))))
#
# full=$(printf %.0f $(echo "$charge * $battery_symbol_count" | bc -l))
# printf '#[bg=%s]' $battery_bg
# [ $full -gt 0 ] && \
# printf "#[fg=colour%s]$battery_symbol_full" $(echo $heat | cut -d' ' -f1-$full)
# printf "#[fg=colour%s]$battery_symbol_full" $(echo $palette | cut -d' ' -f1-$full)
# empty=$(($battery_symbol_count - $full))
# if [ x"$battery_symbol" = x"heart" ]; then
# [ $empty -gt 0 ] && \
@ -400,7 +403,7 @@ run 'for name in $(printenv | grep -Eo ^tmux_conf_[^=]+); do tmux setenv -gu $na
# printf "%0.s$battery_symbol_empty" $(seq 1 $empty)
# else
# [ $empty -gt 0 ] && \
# printf "#[fg=colour%s]$battery_symbol_empty" $(echo $heat | cut -d' ' -f$((full+1))-$(($full + $empty)))
# printf "#[fg=colour%s]$battery_symbol_empty" $(echo $palette | cut -d' ' -f$((full+1))-$(($full + $empty)))
# fi
# fi
# }

View file

@ -7,6 +7,8 @@
# use the heat palette for the battery status
#tmux_conf_battery_palette=heat
# use the gradient palette for the battery status
#tmux_conf_battery_palette=gradient
# display the battery status: charging (U+26A1) / discharging (U+1F50B)
#tmux_conf_battery_status=true