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

added laptop battery status

This commit is contained in:
Gregory Pakosz 2014-02-15 18:39:11 +01:00
parent b8c009db9d
commit 720db6ec08
3 changed files with 62 additions and 1 deletions

View file

@ -217,7 +217,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="#[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})} #[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
@ -278,4 +278,55 @@ run 'for name in $(printenv | grep -Eo ^tmux_conf_[^=]+); do tmux setenv -gu $na
# display "mouse: $new"
# }
#
# battery() {
# battery_symbol=$1
# battery_symbol_count=$2
# if [ $battery_symbol_count = auto ]; then
# columns=$(tmux display -p '#{client_width}' || echo 80)
# if [ $columns -ge 80 ]; then
# battery_symbol_count=10
# else
# battery_symbol_count=5
# fi
# fi
# battery_full_fg=colour160
# battery_full_bg=colour16
# battery_empty_fg=colour254
# battery_empty_bg=colour16
#
# battery_symbol_heart_full=♥
# battery_symbol_heart_empty=♥
# battery_symbol_block_full=◼
# battery_symbol_block_empty=◻
# eval battery_symbol_full='$battery_symbol_'"$battery_symbol"'_full'
# eval battery_symbol_empty='$battery_symbol_'"$battery_symbol"'_empty'
#
# uname_s=$(uname -s)
# if [ $uname_s = Darwin ]; then
# batt=$(pmset -g batt)
# percentage=$(echo $batt |egrep -o [0-9]+%) || return
# charge="${percentage%%%} / 100"
# elif [ $uname_s = Linux ]; then
# batpath=/sys/class/power_supply/BAT0
# if [ ! -d $batpath ]; then
# batpath=/sys/class/power_supply/BAT1
# fi
# batfull=$batpath/energy_full
# batnow=$batpath/energy_now
# if [ ! -r $batfull -o ! -r $batnow ]; then
# return
# fi
# charge="$(cat $batnow) / $(cat $batfull)" || return
# fi
#
# full=$(printf %.0f $(echo "$charge * $battery_symbol_count" | bc -l))
# [ $full -gt 0 ] && \
# printf '#[fg=%s,bg=%s]' $battery_full_fg $battery_full_bg && \
# printf "%0.s$battery_symbol_full" $(seq 1 $full)
# empty=$(($battery_symbol_count - $full))
# [ $empty -gt 0 ] && \
# printf '#[fg=%s,bg=%s]' $battery_empty_fg $battery_empty_bg && \
# printf "%0.s$battery_symbol_empty" $(seq 1 $empty)
# }
#
# $@

9
.tmux.conf.local Normal file
View file

@ -0,0 +1,9 @@
# use the powerline patched font variant of the theme
#tmux_conf_theme=powerline_patched_font
# use 5 hearts for the battery status
#tmux_conf_battery_symbol=heart
#tmux_conf_battery_symbol_count=5
# or alternatively use an external tool, e.g. https://github.com/Goles/Battery
#tmux_conf_battery='#(battery -t) '

View file

@ -11,6 +11,7 @@ Features
- [maximize any pane to a new window with `<prefix>+`](http://pempek.net/articles/2013/04/14/maximizing-tmux-pane-new-window/) (tmux 1.6+)
- mouse mode toggle with `<prefix>m`
- automatic usage of `reattach-to-user-namespace` if available
- laptop battery status
Installation
------------