4th backtick added to .screenrc. Battery status backtick implemented for Xiaomi Notebook Air 13.3 (2016).

This commit is contained in:
Alexey Skobkin 2017-11-22 03:03:11 +03:00
parent 6cf237a7f6
commit bc90321e35
2 changed files with 18 additions and 1 deletions

View file

@ -22,13 +22,14 @@ hardstatus alwayslastline
backtick 1 5 5 sh -c '~/.dotfiles/screen/backticks/1.sh'
backtick 2 10 10 sh -c '~/.dotfiles/screen/backticks/2.sh'
backtick 3 10 10 sh -c '~/.dotfiles/screen/backticks/3.sh'
backtick 4 10 10 sh -c '~/.dotfiles/screen/backticks/4.sh'
# http://www.gnu.org/software/screen/manual/html_node/String-Escapes.html
#
# %H : hostname
# %= : expand to fill all space (used here to make remaining content flush right)
# %` : print output of 'backtick' command (defined elsewhere in .screenrc)
hardstatus string '%{= kG}[ %{G}%H %{g}][%= %{= kw}%?%-Lw%?%{r}(%{W}%n*%f%t%?(%u)%?%{r})%{w}%?%+Lw%?%?%= %{g}][ %1` ][ %2` ][ %3` ][%{B} %d-%m-%Y %{W}%c %{g}]'
hardstatus string '%{= kG}[ %{G}%H %{g}][%= %{= kw}%?%-Lw%?%{r}(%{W}%n*%f%t%?(%u)%?%{r})%{w}%?%+Lw%?%?%= %{g}][ %1` ][ %2` ][ %3` ][ %4` ][%{B} %d-%m-%Y %{W}%c %{g}]'
# use hjkl keys to resize regions
#bind -c rsz h eval "resize -h -5" "command -c rsz"

View file

@ -0,0 +1,16 @@
#!/usr/bin/env bash
show_time () {
date -d@${1} -u '+%H:%M';
}
# Xiaomi Notebook Air 13.3 (2016)
CAPACITY=`cat /sys/class/power_supply/BAT0/capacity`
STATUS=`cat /sys/class/power_supply/BAT0/status`
CURRENT=`cat /sys/class/power_supply/BAT0/current_now`
CHARGE=`cat /sys/class/power_supply/BAT0/charge_now`
ESTIMATE_SEC=`echo "(${CHARGE} * 3600) / ${CURRENT}" | bc -l`
ESTIMATE_SEC_INT=${ESTIMATE_SEC%.*}
ESTIMATE_TEXT=`show_time $ESTIMATE_SEC_INT`
# Printing STATUS, CAPACITY, TIME ESTIMATE
echo "${STATUS:0:1} ${CAPACITY}% (${ESTIMATE_TEXT})"