Git Product home page Git Product logo

tmux-battery-osx's Introduction

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 "

Installation with Tmux Plugin Manager (recommended)

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: ":battery:"
  • charging: ":zap:"
  • 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 ":sunglasses:"
  • set-option -g @batt_charging_icon ":+1:"
  • set-option -g @batt_discharging_icon ":thumbsdown:"

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

tmux-battery-osx's People

Contributors

jgeralnik avatar

Watchers

 avatar  avatar  avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.