Description
Based on several requests (cf. #406, #899historic) and as the general case would be quite interesting, it might be good to have a generic "Custom Script Meter".
The basic idea for such a meter would be, that htop
could allow for up to 4 external "meter scripts" that it would execute and run in the background. The output of the program would then be parsed into a meter as follows:
bar_range:0 1000
bar_data:666 123 42 23
bar_color:4 6 2 1
bar_label:789/1000
text:Custom meter showing 666 foo per 1000 bar. 42 baz happened.
led:666 foo / 123 bar / 42 baz
The lines have the following meaning:
bar_range
: Specifies the min and max limits of the bar meter. Values inbar_data
are scaled accordinglybar_data
: Up to seven integer values separated by space giving the data to show in the bar graph.bar_color
: The colors for up to seven channels denoted by up to 7 integers separated by spaces (1=blue, 2=green, 3=cyan, 4=red, 5=magenta, 6=yellow/orange, 7=grey, 8=shadowed). Missing colors are defaulted to 7 (grey).bar_label
: The text to display right-aligned in the meter. Text left-truncated at spaces if too long. Merges color with displayed bar values.text
: Text to display in the text meter style.led
: Text for the "large digits" display. Digits are automatically displayed as large retro 7-segment LED characters. Otherwise identical to text. If not present, caption fromtext
is used.
The option value starts directly after the colon (:
). For options giving plain numbers, these need to be separated by exactly one space, no decimal separator or thousands separator may be given. Invalid values are dropped and the whole record is replaced by its default values. Settings for bar_range
and bar_color
are remembered (thus only need to be given once), other values must be given at 1Hz or higher. Parsing for the values of one second ends when encountering a blank line. Last record parsed is displayed.