forked from creaktive/rainbarf
-
Notifications
You must be signed in to change notification settings - Fork 1
/
README
240 lines (171 loc) · 7.72 KB
/
README
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
NAME
rainbarf - CPU/RAM/battery stats chart bar for tmux (and GNU screen)
VERSION
version 1.1
SYNOPSIS
rainbarf --tmux --width 40 --no-battery
DESCRIPTION
Fancy resource usage charts to put into the tmux
<http://tmux.sourceforge.net/> status line. The CPU utilization 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* / *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.
USAGE
Installation
* Traditional way:
perl Build.PL
./Build test
./Build install
* MacPorts <http://www.macports.org/> way:
port install rainbarf
* CPAN way:
cpan -i App::rainbarf
* Modern Perl way:
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".
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
"--help"
This.
"--[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 load average <https://en.wikipedia.org/wiki/Load_(computing)>
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.
"--[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"
Maximum "loadavg" you expect before rescaling the chart. Default is
1.
"--order INDEXES"
Specify the memory usage bar order. The default is "fwaic" ( free,
wired, active, inactive & cached ).
"--[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)
<http://manpages.ubuntu.com/manpages/hardy/man1/screen.1.html>
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.
"--datfile FILENAME"
Specify the file to log CPU stats to. Default: $HOME/.rainbarf.dat
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
<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 "--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
* top(1)
<http://developer.apple.com/library/mac/documentation/Darwin/Referen
ce/ManPages/man1/top.1.html> is used to get the CPU/RAM stats if no
/proc filesystem is available.
* ioreg(8)
<http://developer.apple.com/library/mac/documentation/Darwin/Referen
ce/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 <[email protected]>
CONTRIBUTORS
* Chris Knadler <https://github.com/cknadler>
* Clemens Hammacher <https://github.com/hammacher>
* Henrik Hodne <https://github.com/henrikhodne>
* Joe Hassick <https://github.com/jh3>
* Josh Matthews <https://github.com/jmatth>
* 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) 2013 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.