Skip to content

Commit 6f8de03

Browse files
authored
Merge pull request #348 from rjahanbakhshi/main
Support specifying command-line arguments for tmux-mem-cpu-load segment and config gen
2 parents ee018a5 + 4a40bf2 commit 6f8de03

File tree

1 file changed

+13
-2
lines changed

1 file changed

+13
-2
lines changed

segments/tmux_mem_cpu_load.sh

Lines changed: 13 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,22 @@
11
# Print out Memory, cpu and load using https://github.com/thewtex/tmux-mem-cpu-load
22

3+
TMUX_POWERLINE_SEG_TMUX_MEM_CPU_LOAD_ARGS_DEFAULT="-v"
4+
5+
generate_segmentrc() {
6+
read -d '' rccontents << EORC
7+
# Arguments passed to tmux-mem-cpu-load.
8+
# See https://github.com/thewtex/tmux-mem-cpu-load for all available options.
9+
export TMUX_POWERLINE_SEG_TMUX_MEM_CPU_LOAD_ARGS="${TMUX_POWERLINE_SEG_TMUX_MEM_CPU_LOAD_ARGS_DEFAULT}"
10+
EORC
11+
echo "$rccontents"
12+
}
13+
314
run_segment() {
415
stats=""
516
if type $TMUX_PLUGIN_MANAGER_PATH/tmux-mem-cpu-load/tmux-mem-cpu-load > /dev/null 2>&1; then
6-
stats=$($TMUX_PLUGIN_MANAGER_PATH/tmux-mem-cpu-load/tmux-mem-cpu-load)
17+
stats=$($TMUX_PLUGIN_MANAGER_PATH/tmux-mem-cpu-load/tmux-mem-cpu-load $TMUX_POWERLINE_SEG_TMUX_MEM_CPU_LOAD_ARGS)
718
elif type tmux-mem-cpu-load >/dev/null 2>&1; then
8-
stats=$(tmux-mem-cpu-load)
19+
stats=$(tmux-mem-cpu-load $TMUX_POWERLINE_SEG_TMUX_MEM_CPU_LOAD_ARGS)
920
else
1021
return
1122
fi

0 commit comments

Comments
 (0)