Battery info for tmux.
Go to file
Joey Geralnik e583a1696d Change icons to things that work
For some reason, the default icons are not available in my font.
Change them to things that are available
2014-08-31 00:11:41 +02:00
screenshots Add screenshots 2014-05-19 15:01:13 +02:00
scripts Change icons to things that work 2014-08-31 00:11:41 +02:00
battery_osx.tmux Support status-left interpolation too 2014-06-03 12:56:29 +02:00
CHANGELOG.md Update readme to reflect github organization change 2014-07-28 16:31:00 +02:00
LICENSE.md Add Readme and License 2014-05-19 14:30:24 +02:00
README.md Update readme to reflect github organization change 2014-07-28 16:31:00 +02:00

Tmux battery status for OSX

Enables displaying battery percentage and status icon in Tmux status-right.

Battery full:
battery full

Battery discharging, custom discharge icon:
battery discharging, custom icon

Battery charging:
battery charging

This is done by introducing 2 new format strings that can be added to status-right option:

  • #{battery_icon} - will display a battery status icon
  • #{battery_percentage} - will show battery percentage

Usage

Add #{battery_icon} or #{battery_percentage} format strings to existing status-right Tmux option. Example:

# in .tmux.conf
set -g status-right "Batt: #{battery_icon} #{battery_percentage} | %a %h-%d %H:%M "

Add plugin to the list of TPM plugins in .tmux.conf:

set -g @tpm_plugins "                 \
  tmux-plugins/tpm                    \
  tmux-plugins/tmux-battery-osx       \
"

Hit prefix + I to fetch the plugin and source it.

If format strings are added to status-right, they should now be visible.

Manual Installation

Clone the repo:

$ git clone https://github.com/tmux-plugins/tmux-battery-osx ~/clone/path

Add this line to the bottom of .tmux.conf:

run-shell ~/clone/path/battery_osx.tmux

Reload TMUX environment:

# type this in terminal
$ tmux source-file ~/.tmux.conf

If format strings are added to status-right, they should now be visible.

Changing icons

By default, these icons are displayed:

  • charged: "🔋"
  • charging: ""
  • discharging: (nothing shown)

You can change these defaults by adding the following to .tmux.conf (the following lines are not in the code block so that emojis can be seen):

  • set-option -g @batt_charged_icon "😎"
  • set-option -g @batt_charging_icon "👍"
  • set-option -g @batt_discharging_icon "👎"

Reminder: OSX allows you to insert various emojis by pressing Cmd+Ctrl+Space.

Don't forget to reload TMUX environment ($ tmux source-file ~/.tmux.conf) after you do this.

Known issues

  • Battery icon change most likely won't be instant.
    For example, when you un-plug power cord it will take some time (15 - 60 seconds) for the icon to change. This depends on the status-interval TMUX option. Setting it to 15 seconds should be good enough.

Other plugins

You might also find these useful:

  • logging - easy logging and screen capturing
  • online status - online status indicator in Tmux status-right. Useful when on flaky connection to see if you're online.

License

MIT