From 8390d37ed8b9436e4f282e1548bf53275bea52f9 Mon Sep 17 00:00:00 2001 From: Yang Tang Date: Thu, 3 Nov 2016 22:26:31 +0100 Subject: [PATCH] added #{load_avg} --- .tmux.conf | 24 ++++++++++++++++++++++++ .tmux.conf.local | 3 ++- README.md | 1 + 3 files changed, 27 insertions(+), 1 deletion(-) diff --git a/.tmux.conf b/.tmux.conf index 7117838..d2a3c41 100644 --- a/.tmux.conf +++ b/.tmux.conf @@ -524,6 +524,20 @@ run 'cut -c3- ~/.tmux.conf | sh -s _apply_configuration' # }' # } # +# _loadavg() { +# case $(uname -s) in +# *Darwin*) +# tmux set -g @loadavg $(sysctl -q -n vm.loadavg | cut -d' ' -f2) +# ;; +# *Linux*) +# tmux set -g @loadavg $(cut -d' ' -f1 < /proc/loadavg) +# ;; +# *OpenBSD*) +# tmux set -g @loadavg $(sysctl -q -n vm.loadavg | cut -d' ' -f1) +# ;; +# esac +# } +# # _split_window() { # tty=${1:-$(tmux display -p '#{pane_tty}')} # shift @@ -972,6 +986,16 @@ run 'cut -c3- ~/.tmux.conf | sh -s _apply_configuration' # ;; # esac # +# case "$status_left $status_right" in +# *'#{loadavg}'*) +# status_left=$(echo "$status_left" | sed -E \ +# -e 's/#\{(\?)?loadavg/#\{\1@loadavg/g') +# status_right=$(echo "$status_right" | sed -E \ +# -e 's/#\{(\?)?loadavg/#\{\1@loadavg/g') +# status_right="#(cut -c3- ~/.tmux.conf | sh -s _loadavg)$status_right" +# ;; +# esac +# # status_left=$(echo "$status_left" | sed 's%#{circled_session_name}%#(cut -c3- ~/.tmux.conf | sh -s _circled_digit #S)%g') # status_right=$(echo "$status_right" | sed 's%#{circled_session_name}%#(cut -c3- ~/.tmux.conf | sh -s _circled_digit #S)%g') # diff --git a/.tmux.conf.local b/.tmux.conf.local index 918ad2c..0ba97ff 100644 --- a/.tmux.conf.local +++ b/.tmux.conf.local @@ -143,8 +143,9 @@ tmux_conf_theme_right_separator_sub='|' # - #{battery_status} # - #{battery_vbar} # - #{circled_session_name} -# - #{hostname} # - #{hostname_ssh} +# - #{hostname} +# - #{loadavg} # - #{pairing} # - #{prefix} # - #{root} diff --git a/README.md b/README.md index fa1ebed..7a7c9b7 100644 --- a/README.md +++ b/README.md @@ -188,6 +188,7 @@ This configuration supports the following builtin variables: - `#{hostname}`: SSH aware hostname information - `#{hostname_ssh}`: SSH aware hostname information, blank when no SSH connection detected + - `#{loadavg}`: load average - `#{pairing}`: is session attached to more than one client? - `#{prefix}`: is prefix being depressed? - `#{root}`: is current user root?