Plugin enables displaying battery percentage in status line.
Plugin currently only implements interface for upower command-line tool (it's only one I need). But plugin can be easily exteneded to alternative tools.
Installation with TPM
- Add plugin to
~/.tmux.conf
withset -g @plugin 'a1black/simple-tmux-battery-indicator'
- Press
prefix
+ I to fetch the plugin.
-
Clone plugin:
$ git clone https://github/a1black/simple-tmux-battery-indicator ~/clone/path
-
Add plugin to the bottom of
~/.tmux.conf
withrun-shell ~/clone/path/simple_battery.tmux
Add following format strings to tmux status line:
#{battery_status_fg}
- will set foreground color based on battery remain energy#{battery_status_bg}
- will set background color based on battery remain energy#{battery_percentage}
- will show battery remain energy
Add format string to status-right:
# ~/.tmux.conf
set -g status-right '#{battery_percentage} #[fg=default] | #(whoami)'
If battery is not charging this results in output ({remain energy} {remain time} ...)
25% 2:34 | a1black
If battery is charging:
⚡️ 60% | a1black