Home

Awesome

Build Status

NAME

rainbarf - CPU/RAM/battery stats chart bar for tmux (and GNU screen)

VERSION

version 1.4

SYNOPSIS

rainbarf --tmux --width 40 --no-battery

DESCRIPTION

Fancy resource usage charts to put into the tmux status line. The CPU utilization history chart is tinted with the following colors to reflect the system memory allocation:

If available, battery charge is displayed on the right.

SCREENSHOTS

iTerm2 with tmux-powerline, Solarized theme and Terminus font

rainbarf --battery --remaining --rgb

Mac OS X screenshot

OSX Terminal with Tomorrow Night theme and Menlo font

rainbarf --battery --remaining --no-bright

Mac OS X screenshot, v2

Ubuntu Terminal with default theme and Monospace font

rainbarf --battery --bolt --bright

Ubuntu screenshot

BONUS: an animated zsh prompt!

Proof of concept, use at your own risk!

animated zsh prompt

USAGE

Installation

Configuration

Add the following line to your ~/.tmux.conf file:

set-option -g status-utf8 on
set -g status-right '#(rainbarf)'

Or, under GNOME Terminal:

set-option -g status-utf8 on
set -g status-right '#(rainbarf --rgb)'

Reload the tmux config by running tmux source-file ~/.tmux.conf.

CONFIGURATION FILE

~/.rainbarf.conf can be used to persistently store "OPTIONS":

# example configuration file
width=20   # widget width
bolt       # fancy charging character
remaining  # display remaining battery
rgb        # 256-colored palette

"OPTIONS" specified via command line override that values. Configuration file can be specified via RAINBARF environment variable:

RAINBARF=~/.rainbarf.conf rainbarf

OPTIONS

CAVEAT

Time remaining

If the --remaining option is present but you do not see the time in your status bar, you may need to increase the value of status-right-length to 48.

Color scheme

If you only see the memory usage bars but no CPU utilization chart, that's because your terminal's color scheme need an explicit distinction between foreground and background colors. For instance, "red on red background" will be displayed as a red block on such terminals. Thus, you may need the ANSI bright attribute for greater contrast, or maybe consider switching to the 256-color palette. There are some issues with that, though:

  1. Other color schemes (notably, solarized) have different meaning for the ANSI bright attribute. So using it will result in a quite psychedelic appearance. 256-color pallette, activated by the --rgb flag, is unaffected by that.
  2. The older versions of Term::ANSIColor dependency do not recognize bright/RGB settings, falling back to the default behavior (plain 16 colors). However, the whole Term::ANSIColor is optional, it is only required to preview the effects of the "OPTIONS" via command line before actually editing the ~/.tmux.conf. That is, rainbarf --bright --tmux is guaranteed to work despite the outdated Term::ANSIColor!

Another option is skipping the system colors altogether and use the RGB palette (rainbarf --rgb). This fixes the issue 1, but doesn't affect the issue 2. It still looks better, though.

Persistent storage

CPU utilization stats are persistently stored in the ~/.rainbarf.dat file. Every rainbarf execution will update and rotate that file. Since tmux calls rainbarf periodically (every 15 seconds, by default), the chart will display CPU utilization for the last ~9.5 minutes (15 * 38). Thus, several tmux instances running simultaneously for the same user will result in a faster chart scrolling.

screen

Stable screen version unfortunately has a broken UTF-8 handling specifically for the status bar. Thus, I have only tested the rainbarf with the variant from git://git.savannah.gnu.org/screen.git. My ~/.screenrc contents:

backtick 1 15 15 rainbarf --bright --screen
hardstatus string "%1`"
hardstatus lastline

REFERENCES

AUTHOR

Stanislaw Pusep stas@sysd.org

CONTRIBUTORS

COPYRIGHT AND LICENSE

This software is copyright (c) 2016 by Stanislaw Pusep stas@sysd.org.

This is free software; you can redistribute it and/or modify it under the same terms as the Perl 5 programming language system itself.