RAINBARF(1)
okay so bestie, you've stumbled into rainbarf(1) β the User Contributed Perl Documentation page, no less β and honestly? it's a little gem. Let's get into it π
π NAME π
rainbarf β a 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 β here's the link babe, http://tmux.sourceforge.net/. The CPU utilization history chart is tinted with the following colors to reflect the system memory allocation, and it's literally so satisfying to watch:
- green: free memory;
- yellow: active memory;
- blue: inactive memory;
- red: wired memory on Mac OS X / FreeBSD; "unaccounted" memory on Linux;
- cyan: cached memory on Linux, buf on FreeBSD.
- magenta: used swap memory.
If available, battery charge is displayed on the right. π«Ά
Just go to https://github.com/creaktive/rainbarf to see some screenshots, iykyk.
π₯ USAGE π₯
πΈ Installation πΈ
- Traditional way β the OGs:
perl Build.PL
./Build test
./Build install
- Homebrew way (
http://brew.sh/):
brew install rainbarf
- MacPorts way (
http://www.macports.org/):
port install rainbarf
- CPAN way:
cpan -i App::rainbarf
- Modern Perl way, main character energy:
cpanm git://github.com/creaktive/rainbarf.git
π 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. slay β¨
π 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 π
Okay bestie, here's the full menu β every single one, no skips π
--helpβ This. (iconic)--[no]batteryβ Display the battery charge indicator. Enabled by default.--[no]remainingβ Display the time remaining until the battery is fully charged/empty. See CAVEAT. Disabled by default.--[no]boltβ Display even fancier battery indicator. Disabled by default.--[no]brightβ Tricky one. Disabled by default. See CAVEAT.--[no]rgbβ Use the RGB palette instead of the system colors. Also disabled by default, for the same reasons as above.--fg COLOR_NAMEβ Force chart foreground color.--bg COLOR_NAMEβ Force chart background color.--[no]loadavgβ Use the load average metric (as inhttps://en.wikipedia.org/wiki/Load_(computing)) instead of CPU utilization. You might want to set the--maxthreshold since this is an absolute value and has varying ranges on different systems. Disabled by default.--[no]swapβ Display the swap usage. Used swap amount is added to the total amount, but the free swap amount is not! Disabled by default.--max NUMBERβ Maximumloadavgyou expect before rescaling the chart. Default is1.--order INDEXESβ Specify the memory usage bar order. The default isfwaic( free, wired, active, inactive & cached ).--[no]tmuxβ Forcetmuxcolors mode. By default, rainbarf detects automatically if it is being called fromtmuxor from the interactive shell.--screenβscreen(1)colors mode (http://manpages.ubuntu.com/manpages/hardy/man1/screen.1.html). Experimental. See CAVEAT.--width NUMBERβ Chart width. Default is38, so both the chart and the battery indicator fit thetmuxstatus line. Higher values may require disabling the battery indicator or raising thestatus-right-lengthvalue in~/.tmux.conf.--datfile FILENAMEβ Specify the file to log CPU stats to. Default:$HOME/.rainbarf.dat--skip NUMBERβ Do not write CPU stats if file already exists and is newer than this many seconds. Useful if you refreshtmuxstatus quite frequently.
π 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. not me forgetting that and being confused π
π¨ 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:
- Other color schemes (notably, solarized β
http://ethanschoonover.com/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--rgbflag, is unaffected by that. - 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
OPTIONSvia command line before actually editing the~/.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 (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. fr fr, that's the math πΈ
π₯οΈ 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 π
top(1)(http://developer.apple.com/library/mac/documentation/Darwin/Reference/ManPages/man1/top.1.html) is used to get the CPU/RAM stats if no/procfilesystem is available.ioreg(8)(http://developer.apple.com/library/mac/documentation/Darwin/Reference/ManPages/man8/ioreg.8.html) is used to get the battery status on Mac OS X.- ACPI (
http://www.tldp.org/howto/acpi-howto/usingacpi.html) is used to get the battery status on Linux. - Battery (
https://github.com/Goles/Battery) was a source of inspiration. - Spark (
http://zachholman.com/spark/) was another source of inspiration.
π AUTHOR π
Stanislaw Pusep <stas@sysd.org>
π«Ά CONTRIBUTORS π«Ά
- Chris Knadler
https://github.com/cknadler - cinaeco
https://github.com/cinaeco - Clemens Hammacher
https://github.com/hammacher - H.Merijn Brand
https://github.com/Tux - Henrik Hodne
https://github.com/henrikhodne - Joe Hassick
https://github.com/jh3 - Josh Matthews
https://github.com/jmatth - Lars Engels
https://github.com/larsengels - Sergey Romanov
https://github.com/sergeyromanov - Tom Cammann
https://github.com/takac - Tuomas Jormola
https://github.com/tjormola
π 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.
and that's the whole page bestie βperl v5.42.3, dated2016-09-06, filed underRAINBARF(1). go forth and make your status line gorgeous π β¨
π¦ where this page comes from
- nixos 26.05: perl5.42.3-App-rainbarf 1.4
- nixpkgs unstable: perl5.42.3-App-rainbarf 1.4
- π girlified by deepseek-ai/DeepSeek-V4.1-Flash-1017 on : a language model's rewrite of the original, under its terms