| FazBrowse GitHub Viewer | Trending | | Home |
| Tools: [Download Repo ZIP] [Original HTTPS Page] |
| Name | Name | Last commit date | ||
|---|---|---|---|---|
A simple, lightweight program provided for system monitoring in the status line of tmux.
The memory monitor displays the used and available memory.
The CPU usage monitor outputs a percent CPU usage over all processors. It also displays a textual bar graph of the current percent usage.
The system load average is also displayed.
Example output:
2885/7987MB [||||| ] 51.2% 2.11 2.35 2.44 ^ ^ ^ ^ ^ ^ ^ | | | | | | | 1 2 3 4 5 6 7
For terminals with 256 color support, graded colors can be displayed by passing the --colors flag.
Currently, Linux, Mac OSX, FreeBSD, OpenBSD, and NetBSD are supported.
There are links to the source code at the project homepage.
cd <source dir> cmake . make
su - make install logout
Include the plugin in your .tmux.conf, the same file you'll set the configuration in, below.
set -g @plugin 'thewtex/tmux-mem-cpu-load'
Include the bundle in your .zshrc
antigen bundle thewtex/tmux-mem-cpu-load
Edit $HOME/.tmux.conf to display the program's output in status-left or status-right. For example:
set -g status-interval 2 set -g status-left "#S #[fg=green,bg=black]#(tmux-mem-cpu-load --colors --interval 2)#[default]" set -g status-left-length 60
If you installed using tpm, you must specify the full path to the tmux-mem-cpu-load script, like below:
set -g status-right "#[fg=green]#($TMUX_PLUGIN_MANAGER_PATH/tmux-mem-cpu-load/tmux-mem-cpu-load --colors --powerline-right --interval 2)#[default]"
Note that the interval argument to tmux-mem-cpu-load should be the same number of seconds that status-interval is set at.
Another optional argument is the number of bars in the bar graph, which defaults to 10. This can, for instance, be set to the number of cores in a multi-core system.
The colors option will add graded colors for each of the measures.
The full usage:
Usage: tmux-mem-cpu-load [OPTIONS]
Available options:
-h, --help
Prints this help message
-c, --colors
Use tmux colors in output
-p, --powerline-left
Use powerline left symbols throughout the output, enables --colors
-q, --powerline-right
Use powerline right symbols throughout the output, enables --colors
-v, --vertical-graph
Use vertical bar chart for CPU graph
--tick-graph
Use a single coloured block character as the graph, drawn after the
value, for both memory and CPU
-l <value>, --segments-left <value>
Enable blending bg/fg color (depending on -p or -q use) with segment to left
Provide color to be used depending on -p or -q option for seamless segment blending
Color is an integer value which uses the standard tmux color palette values
-r <value>, --segments-right <value>
Enable blending bg/fg color (depending on -p or -q use) with segment to right
Provide color to be used depending on -p or -q option for seamless segment blending
Color is an integer value which uses the standard tmux color palette values
-i <value>, --interval <value>
Set tmux status refresh interval in seconds. Default: 1 second
-g <value>, --graph-lines <value>
Set how many lines should be drawn in a graph. Default: 10
-m <value>, --mem-mode <value>
Set memory display mode. 0: Default, 1: Free memory, 2: Usage percent,
3: Used/total gigabytes.
-t <value>, --cpu-mode <value>
Set cpu % display mode. 0: Default max 100%, 1: Max 100% * number of threads.
-a <value>, --averages-count <value>
Set how many load-averages should be drawn. Default: 3
--cpu-only
Only output the CPU segment
--mem-only
Only output the memory segment
By default all three measurements are printed as one string. --cpu-only and --mem-only each print a single measurement instead, so that tmux can style them independently. Combined with --tick-graph this gives two self-contained segments:
set -g status-right "#(tmux-mem-cpu-load --cpu-only --tick-graph) #(tmux-mem-cpu-load --mem-only --tick-graph --mem-mode 3)"
which renders as:
16.0% ▂ 16.22/32.00GB ▄
The tick is coloured green below 75%, yellow above it and red above 90%, and the foreground colour is reset afterwards so it does not leak into the rest of the status line.
Note that each invocation samples the CPU for its own interval, so calling the program twice doubles the sampling cost.
The -l and -r options when used in conjunction with a recent version of Tmux Powerline that has the ability to selectively disable spacing and separators between segments allow for seamless blending of tmux-mem-cpu-load output with other adjacent segments. The end result is dynamic changing of appropriate foreground and background colors as the start and end of the tmux-mem-cpu-load output string that is aggregated with other Tmux Powerline output to produce a more polished status line in Tmux.
Segment Adjaceny before this feature:
Segment Adjaceny after this feature:
Note that the values for the -l and -r options will be the standard Tmux integer color values. They set the appropriate background and foreground colors used for the separator character when used with the poweline-left or powerline-right options so it is easy to match coloring to adjacent segments. An example from the segment script that calls tmux-mem-cpu-load is as follows:
tmux-mem-cpu-load -q -v -l 52 -r 33
This combines with theme options available to tmux-powerline, such as the following:
"disk_usage_cust 52 123 ${TMUX_POWERLINE_SEPARATOR_LEFT_BOLD} 52 123 right_disable" \
"tmux_mem_cpu_load_cust 52 234 ${TMUX_POWERLINE_SEPARATOR_LEFT_BOLD} 52 234 both_disable separator_disable" \
"batt_cust 33 154 ${TMUX_POWERLINE_SEPARATOR_LEFT_BOLD} 16 33 N separator_disable" \
Matt McCormick (thewtex) <matt@mmmccormick.com>
Contributions from:
| Back | FazBrowse Home | New Git URL |