rainbarf - CPU/RAM/battery stats chart bar for tmux (and GNU screen)
rainbarf --tmux --width 40 --no-battery
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.
rainbarf --battery --remaining --rgb
rainbarf --battery --remaining --no-bright
rainbarf --battery --bolt --bright
Proof of concept, use at your own risk!
perl Build.PL ./Build test ./Build install
brew install rainbarf
port install rainbarf
cpan -i App::rainbarf
Modern Perl way:
Add the following line to your
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.
~/.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:
Display the battery charge indicator. Enabled by default.
Display the time remaining until the battery is fully charged/empty. See "CAVEAT". Disabled by default.
Display even fancier battery indicator
Disabled by default.
Tricky one. Disabled by default. See "CAVEAT".
Use the RGB palette instead of the system colors. Also disabled by default, for the same reasons as above.
Force chart foreground color.
Force chart background color.
Use load average metric instead of CPU utilization.
You might want to set the
--max threshold since this is an absolute value and has varying ranges on different systems.
Disabled by default.
Display the swap usage. Used swap amount is added to the total amount, but the free swap amount is not! Disabled by default.
loadavg you expect before rescaling the chart. Default is 1.
Specify the memory usage bar order.
The default is
fwaic (free, wired, active, inactive & cached).
tmux colors mode.
By default, rainbarf detects automatically if it is being called from
tmux or from the interactive shell.
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
Specify the file to log CPU stats to.
Do not write CPU stats if file already exists and is newer than this many seconds.
Useful if you refresh
tmux status quite frequently.
--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.
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:
--rgbflag, is unaffected by that.
~/.tmux.conf. That is,
rainbarf --bright --tmuxis guaranteed to work despite the outdated Term::ANSIColor!
Another option is skipping the system colors altogether and use the RGB palette (
This fixes the issue 1, but doesn't affect the issue 2.
It still looks better, though.
CPU utilization stats are persistently stored in the
Every rainbarf execution will update and rotate that file.
tmux calls rainbarf periodically (every 15 seconds, by default), the chart will display CPU utilization for the last ~9.5 minutes (15 * 38).
tmux instances running simultaneously for the same user will result in a faster chart scrolling.
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.
backtick 1 15 15 rainbarf --bright --screen hardstatus string "%1`" hardstatus lastline
/procfilesystem is available.
Stanislaw Pusep [email protected]
This software is copyright (c) 2016 by Stanislaw Pusep [email protected].
This is free software; you can redistribute it and/or modify it under the same terms as the Perl 5 programming language system itself.