mirror of
https://bitbucket.org/skobkin/dotfiles.git
synced 2024-12-27 01:24:20 +00:00
4th backtick added to .screenrc. Battery status backtick implemented for Xiaomi Notebook Air 13.3 (2016).
This commit is contained in:
parent
6cf237a7f6
commit
bc90321e35
|
@ -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"
|
||||
|
|
16
screen/backticks/battery-laptop-xiaomi.sh
Executable file
16
screen/backticks/battery-laptop-xiaomi.sh
Executable 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})"
|
Loading…
Reference in a new issue