Skip to content

Instantly share code, notes, and snippets.

@yradunchev
Last active January 14, 2021 17:11
Show Gist options
  • Select an option

  • Save yradunchev/dfb68a6f552645b279bda99c49d1c443 to your computer and use it in GitHub Desktop.

Select an option

Save yradunchev/dfb68a6f552645b279bda99c49d1c443 to your computer and use it in GitHub Desktop.
Show laptop battery status in GNU Screen terminal multiplexer
startup_message off
screen -t bash1 0
screen -t bash2 1
select 0
altscreen on
term screen-256color
bind ',' prev
bind '.' next
vbell off
defscrollback 5000
backtick 1 59 1 $HOME/bin/batstats
#change the hardstatus settings to give an window list at the bottom of the
#screen, with the time and date and with the current window highlighted
hardstatus alwayslastline
hardstatus string '%{= kG}[ %{G}%H %{g}][%= %{= kw}%?%-Lw%?%{r}(%{W}%n*%f%t%?(%u)%?%{r})%{w}%?%+Lw%?%?%= %{g}][%1`%{g}][%{B} %m-%d %{W}%c %{g}]'
trem=$( acpi | cut -d" " -f5 )
blif=$( upower -d | \
awk '$1 == "percentage:" { power=substr($2, 0, index($2, "%")); \
if (power < 20) { color="\005{..r}"; } \
else if (power < 40) { color="\005{..y}"; } \
else { color="\005{..g}";} \
printf "%s%d\n",color,power; exit}' )
echo "$blif%, $trem"
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment