added battery status indicator (charging / discharging)
This commit is contained in:
parent
3e7170ecf5
commit
b37311fbbe
2 changed files with 19 additions and 5 deletions
21
.tmux.conf
21
.tmux.conf
|
@ -253,7 +253,7 @@ run 'for name in $(printenv | grep -Eo ^tmux_conf_[^=]+); do tmux setenv -gu $na
|
||||||
# whoami_bg=colour160 # red
|
# whoami_bg=colour160 # red
|
||||||
# host_fg=colour16 # black
|
# host_fg=colour16 # black
|
||||||
# host_bg=colour254 # white
|
# 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"
|
# tmux set -g status-right-length 64 \; set -g status-right "$status_right"
|
||||||
#
|
#
|
||||||
# # clock
|
# # clock
|
||||||
|
@ -318,8 +318,9 @@ run 'for name in $(printenv | grep -Eo ^tmux_conf_[^=]+); do tmux setenv -gu $na
|
||||||
# battery_symbol=$1
|
# battery_symbol=$1
|
||||||
# battery_symbol_count=$2
|
# battery_symbol_count=$2
|
||||||
# battery_palette=$3
|
# battery_palette=$3
|
||||||
# if [ $battery_symbol_count = auto ]; then
|
# battery_status=$4
|
||||||
# columns=$(tmux display -p '#{client_width}' || echo 80)
|
# 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
|
# if [ $columns -ge 80 ]; then
|
||||||
# battery_symbol_count=10
|
# battery_symbol_count=10
|
||||||
# else
|
# 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'
|
# eval battery_symbol_empty='$battery_symbol_'"$battery_symbol"'_empty'
|
||||||
#
|
#
|
||||||
# uname_s=$(uname -s)
|
# uname_s=$(uname -s)
|
||||||
# if [ $uname_s = Darwin ]; then
|
# if [ x"$uname_s" = x"Darwin" ]; then
|
||||||
# batt=$(pmset -g batt)
|
# batt=$(pmset -g batt)
|
||||||
# percentage=$(echo $batt |egrep -o [0-9]+%) || return
|
# percentage=$(echo $batt |egrep -o [0-9]+%) || return
|
||||||
|
# discharging=$(echo $batt | grep -qi "discharging" && echo "true" || echo "false")
|
||||||
# charge="${percentage%%%} / 100"
|
# charge="${percentage%%%} / 100"
|
||||||
# elif [ $uname_s = Linux ]; then
|
# elif [ x"$uname_s" = x"Linux" ]; then
|
||||||
# batpath=/sys/class/power_supply/BAT0
|
# batpath=/sys/class/power_supply/BAT0
|
||||||
# if [ ! -d $batpath ]; then
|
# if [ ! -d $batpath ]; then
|
||||||
# batpath=/sys/class/power_supply/BAT1
|
# 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
|
# if [ ! -r $batfull -o ! -r $batnow ]; then
|
||||||
# return
|
# return
|
||||||
# fi
|
# fi
|
||||||
|
# discharging=$(grep -qi "discharging" $batpath/status && echo "true" || echo "false")
|
||||||
# charge="$(cat $batnow) / $(cat $batfull)" || return
|
# charge="$(cat $batnow) / $(cat $batfull)" || return
|
||||||
# fi
|
# 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
|
# if echo $battery_palette | grep -q -E '^(colour[0-9]{1,3},?){3}$'; then
|
||||||
# battery_full_fg=$(echo $battery_palette | cut -d, -f1)
|
# battery_full_fg=$(echo $battery_palette | cut -d, -f1)
|
||||||
# battery_empty_fg=$(echo $battery_palette | cut -d, -f2)
|
# battery_empty_fg=$(echo $battery_palette | cut -d, -f2)
|
||||||
|
|
|
@ -8,6 +8,9 @@
|
||||||
# use the heat palette for the battery status
|
# use the heat palette for the battery status
|
||||||
#tmux_conf_battery_palette=heat
|
#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
|
# or alternatively use an external tool, e.g. https://github.com/Goles/Battery
|
||||||
#tmux_conf_battery='#(battery -t) '
|
#tmux_conf_battery='#(battery -t) '
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue