Display battery/power status in tmux status bar.
Supports:
- macOS
The easiest way to install tmux-power is via the Tmux Plugin
Manager.
-
Add plugin to the list of TPM plugins in
.tmux.conf:set -g @plugin 'jamesoff/tmux-power'
-
Use prefix–I to install
tmux-power. -
When you want to update
tmux-poweruse prefix–U.
-
Clone the repository
$ git clone https://github.com/jamesoff/tmux-power ~/clone/path -
Add this line to the bottom of
.tmux.confrun-shell ~/clone/path/tmux-power.tmux -
Reload the
tmuxenvironment# type this inside tmux $ tmux source-file ~/.tmux.conf
This plugin is hard-coded to check if the gpd0 interface is up.
Edit your status-left or status-right setting to include:
#{power}- display the power status
Reload your configuration for it to take effect: prefix-R with TPM, or
$ tmux source-file ~/.tmux.confYou will need a Nerd Font for the symbol to show correctly.
The battery icon will go red/yellow/green to show the battery level. It will go blue when charging, and change to a power plug when fully charged and plugged in.
The battery icon will not show up unless the session name is fullscreen or remote, as if it is not, it suggests you should be able to see the battery status in the status bar. (See my tmux configuration for info about how I use session names.)