Battery info for tmux.
Go to file
2016-09-24 23:58:16 +02:00
screenshots update readme with battery remain info 2015-02-17 13:18:44 -05:00
scripts Show correct percentage and time for charging/discharging (#35) 2016-09-24 21:48:09 +02:00
.gitattributes Don't modify line endings of screenshot images 2015-12-26 23:39:17 +01:00
battery.tmux Fix status-right, status-left whitespace issue 2015-05-23 13:37:32 +02:00
CHANGELOG.md Bump version in CHANGELOG.md 2016-09-24 23:58:16 +02:00
LICENSE.md Add Readme and License 2014-05-19 14:30:24 +02:00
README.md Update plugin installation instructions 2015-08-10 20:40:14 +02:00

Tmux battery status

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

Battery full (for OS X):
battery full

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

Battery charging:
battery charging

Battery remain:
battery remain

This is done by introducing 3 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
  • #{battery_remain} - will show remaining time of battery charge

Usage

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

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

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

set -g @plugin 'tmux-plugins/tmux-battery'

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 ~/clone/path

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

run-shell ~/clone/path/battery.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: "🔋" ("❇ " when not on OS X)
  • charging: ""
  • discharging: (nothing shown)
  • attached but not charging: "⚠️"

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 -g @batt_charged_icon "😎"
  • set -g @batt_charging_icon "👍"
  • set -g @batt_discharging_icon "👎"
  • set -g @batt_attached_icon "😐"

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

Limitations

  • Battery icon change most likely won't be instant.
    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 goodies

You might also find these useful:

  • resurrect - restore tmux environment after system restart
  • 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.

You might want to follow @brunosutic on twitter if you want to hear about new tmux plugins or feature updates.

Contributors

License

MIT