1
0
Fork 0
mirror of synced 2024-05-26 20:11:09 -04:00

added battery status indicator (charging / discharging)

This commit is contained in:
Gregory Pakosz 2015-04-27 17:53:14 +02:00
parent 3e7170ecf5
commit b37311fbbe
2 changed files with 19 additions and 5 deletions

View file

@ -253,7 +253,7 @@ run 'for name in $(printenv | grep -Eo ^tmux_conf_[^=]+); do tmux setenv -gu $na
# whoami_bg=colour160 # red
# host_fg=colour16 # black
# host_bg=colour254 # white
# status_right="${tmux_conf_battery:-#(cut -c3- ~/.tmux.conf | sh -s battery ${tmux_conf_battery_symbol:-block} ${tmux_conf_battery_symbol_count:-auto} ${tmux_conf_battery_palette:-colour160,colour254,colour16})} #[fg=$time_date_fg,nobold]$right_separator %R $right_separator %d %b #[fg=$whoami_bg,bg=$time_date_bg,nobold]$right_separator_black#[fg=$whoami_fg,bg=$whoami_bg,nobold] #(whoami) $right_separator_black#[fg=$host_fg,bg=$host_bg,bold] #h "
# status_right="${tmux_conf_battery:-#(cut -c3- ~/.tmux.conf | sh -s battery ${tmux_conf_battery_symbol:-block} ${tmux_conf_battery_symbol_count:-auto} ${tmux_conf_battery_palette:-colour160,colour254,colour16} ${tmux_conf_battery_status})} #[fg=$time_date_fg,nobold]$right_separator %R $right_separator %d %b #[fg=$whoami_bg,bg=$time_date_bg,nobold]$right_separator_black#[fg=$whoami_fg,bg=$whoami_bg,nobold] #(whoami) $right_separator_black#[fg=$host_fg,bg=$host_bg,bold] #h "
# tmux set -g status-right-length 64 \; set -g status-right "$status_right"
#
# # clock
@ -318,8 +318,9 @@ run 'for name in $(printenv | grep -Eo ^tmux_conf_[^=]+); do tmux setenv -gu $na
# battery_symbol=$1
# battery_symbol_count=$2
# battery_palette=$3
# if [ $battery_symbol_count = auto ]; then
# columns=$(tmux display -p '#{client_width}' || echo 80)
# battery_status=$4
# if [ x"$battery_symbol_count" = x"auto" ]; then
# columns=$(tmux -q display -p '#{client_width}' 2> /dev/null || echo 80)
# if [ $columns -ge 80 ]; then
# battery_symbol_count=10
# else
@ -334,11 +335,12 @@ run 'for name in $(printenv | grep -Eo ^tmux_conf_[^=]+); do tmux setenv -gu $na
# eval battery_symbol_empty='$battery_symbol_'"$battery_symbol"'_empty'
#
# uname_s=$(uname -s)
# if [ $uname_s = Darwin ]; then
# if [ x"$uname_s" = x"Darwin" ]; then
# batt=$(pmset -g batt)
# percentage=$(echo $batt |egrep -o [0-9]+%) || return
# discharging=$(echo $batt | grep -qi "discharging" && echo "true" || echo "false")
# charge="${percentage%%%} / 100"
# elif [ $uname_s = Linux ]; then
# elif [ x"$uname_s" = x"Linux" ]; then
# batpath=/sys/class/power_supply/BAT0
# if [ ! -d $batpath ]; then
# batpath=/sys/class/power_supply/BAT1
@ -348,9 +350,18 @@ run 'for name in $(printenv | grep -Eo ^tmux_conf_[^=]+); do tmux setenv -gu $na
# if [ ! -r $batfull -o ! -r $batnow ]; then
# return
# fi
# discharging=$(grep -qi "discharging" $batpath/status && echo "true" || echo "false")
# charge="$(cat $batnow) / $(cat $batfull)" || return
# fi
#
# if [ x"$battery_status" = x"1" -o x"$battery_status" = x"true" ]; then
# if [ x"$discharging" = x"true" ]; then
# printf "%s " 🔋
# else
# printf "%s " ⚡
# fi
# fi
#
# if echo $battery_palette | grep -q -E '^(colour[0-9]{1,3},?){3}$'; then
# battery_full_fg=$(echo $battery_palette | cut -d, -f1)
# battery_empty_fg=$(echo $battery_palette | cut -d, -f2)

View file

@ -8,6 +8,9 @@
# use the heat palette for the battery status
#tmux_conf_battery_palette=heat
# display the battery status: charging (U+26A1) / discharging (U+1F50B)
#tmux_conf_battery_status=true
# or alternatively use an external tool, e.g. https://github.com/Goles/Battery
#tmux_conf_battery='#(battery -t) '