Skip to content

Instantly share code, notes, and snippets.

@pop
Created September 2, 2014 05:06
Show Gist options
  • Save pop/92f4ae38c2a05812d873 to your computer and use it in GitHub Desktop.
Save pop/92f4ae38c2a05812d873 to your computer and use it in GitHub Desktop.
A simple way to display the time remaining for your laptop battery in your tmux prompt
#!/bin/sh
### ~/bin/battery_time_remaining.sh
### Elijah Caine | pop_n_fresh @ irc.freenode.net
### Displays the time remaining on your battery
### Requires acpi - Displays nothing without it
## '{print $5} can be changed to '{print $4}' for a percentage
BAT_TIME=$(acpi | awk '{print $5}')
echo $BAT_TIME
set status-interval 15
set -g status-right "Bat [ #(~/bin/battery_time_remaining.sh) ] ~ [ #[fg=black]%H:%M ]"
set -g status-left ""
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment