Coder Social home page Coder Social logo

rainbarf's Introduction

NAME

rainbarf - CPU/RAM stats chart for tmux & screen

VERSION

version 0.2

SYNOPSIS

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

DESCRIPTION

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

  • green: free memory;
  • yellow: active memory;
  • blue: inactive memory;
  • red: wired memory on Mac OS X;
  • cyan: cached memory on Linux.

If available, battery charge is displayed on the right.

SCREENSHOTS

iTerm2 with solarized theme and ProFont

rainbarf --battery --no-bright

Mac OS X screenshot

Ubuntu Terminal with default theme and Monospace font

rainbarf --battery --bolt --bright

Ubuntu screenshot

USAGE

Put rainbarf into your $PATH. Add the following line to your ~/.tmux.conf file:

set -g status-right '#(rainbarf)'

Or, under GNOME Terminal:

set -g status-right '#(rainbarf --bright)'

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

OPTIONS

  • --help

    This. To see as a manpage, use perldoc ~/bin/rainbarf (if you put rainbarf in your ~/bin).

  • --[no]battery

    Display the battery charge indicator.

  • --[no]bolt

    Display even fancier battery indicator โšก.

  • --[no]bright

    Tricky one. Disabled by default. See "CAVEAT".

  • --fg COLOR_NAME

    Force chart foreground color.

  • --bg COLOR_NAME

    Force chart background color.

  • --max NUMBER

    Maximum load you expect before rescaling the chart. Default is 1.

  • --order INDEXES

    Specify the memory usage bar order. The default is fwaic (__f__ree, __w__ired, __a__ctive, __i__nactive & __c__ached).

  • --[no]tmux

    Force tmux colors mode. By default, rainbarf detects automatically if it is being called from tmux or from the interactive shell.

  • --screen

    screen(1) colors mode. Experimental. See "CAVEAT".

  • --width NUMBER

    Chart width. Default is 38, so both the chart and the battery indicator fit the tmux status line. Higher values may require disabling the battery indicator or raising the status-right-length value in ~/.tmux.conf.

CAVEAT

Color scheme

If you only see the memory usage bars but no load 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. There are two problems with it, 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.
  2. The older versions of Term::ANSIColor dependency do not recognize it at all, resulting in a confusing error message Invalid attribute name bright_yellow at .... 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!

Persistent storage

Load 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 load 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

  • uptime(1) is used to get the load stats if /proc/loadavg is unavailable.
  • vm_stat(1) is used to get the memory stats if /proc/meminfo is unavailable.
  • ioreg(8) is used to get the battery status on Mac OS X.
  • ACPI is used to get the battery status on Linux.
  • Battery was a source of inspiration.
  • Spark was another source of inspiration.

AUTHOR

Stanislaw Pusep [email protected]

COPYRIGHT AND LICENSE

This software is copyright (c) 2013 by Stanislaw Pusep.

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

rainbarf's People

Contributors

creaktive avatar tjormola avatar

Watchers

Lizhao Hou 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.