added support for #{uptime_y} variable
This commit is contained in:
parent
d2df5cf4d4
commit
e0a45082eb
3 changed files with 15 additions and 4 deletions
11
.tmux.conf
11
.tmux.conf
|
@ -603,6 +603,7 @@ run 'cut -c3- ~/.tmux.conf | sh -s _apply_configuration'
|
|||
# now=$(date +%s)
|
||||
# ;;
|
||||
# *Linux*|*CYGWIN*|*MSYS*|*MINGW*)
|
||||
# boot=0
|
||||
# now=$(cut -d' ' -f1 < /proc/uptime)
|
||||
# ;;
|
||||
# *OpenBSD*)
|
||||
|
@ -613,12 +614,16 @@ run 'cut -c3- ~/.tmux.conf | sh -s _apply_configuration'
|
|||
# awk -v boot="$boot" -v now="$now" '
|
||||
# BEGIN {
|
||||
# uptime = now - boot
|
||||
# y = int(uptime / 31536000)
|
||||
# dy = int(uptime / 86400) % 365
|
||||
# d = int(uptime / 86400)
|
||||
# h = int(uptime / 3600) % 24
|
||||
# m = int(uptime / 60) % 60
|
||||
# s = int(uptime) % 60
|
||||
#
|
||||
# system("tmux set -g @uptime_d " d + 0 " \\; " \
|
||||
# system("tmux set -g @uptime_y " y + 0 " \\; " \
|
||||
# "set -g @uptime_dy " dy + 0 " \\; " \
|
||||
# "set -g @uptime_d " d + 0 " \\; " \
|
||||
# "set -g @uptime_h " h + 0 " \\; " \
|
||||
# "set -g @uptime_m " m + 0 " \\; " \
|
||||
# "set -g @uptime_s " s + 0)
|
||||
|
@ -1145,12 +1150,16 @@ run 'cut -c3- ~/.tmux.conf | sh -s _apply_configuration'
|
|||
# case "$status_left $status_right" in
|
||||
# *'#{uptime_d}'*|*'#{uptime_h}'*|*'#{uptime_m}'*)
|
||||
# status_left=$(echo "$status_left" | sed -E \
|
||||
# -e 's/#\{(\?)?uptime_y/#\{\1@uptime_y/g' \
|
||||
# -e 's/#\{(\?)?uptime_d/#\{\1@uptime_d/g' \
|
||||
# -e '/@uptime_y/ s/@uptime_d/@uptime_dy/g' \
|
||||
# -e 's/#\{(\?)?uptime_h/#\{\1@uptime_h/g' \
|
||||
# -e 's/#\{(\?)?uptime_m/#\{\1@uptime_m/g' \
|
||||
# -e 's/#\{(\?)?uptime_s/#\{\1@uptime_s/g')
|
||||
# status_right=$(echo "$status_right" | sed -E \
|
||||
# -e 's/#\{(\?)?uptime_y/#\{\1@uptime_y/g' \
|
||||
# -e 's/#\{(\?)?uptime_d/#\{\1@uptime_d/g' \
|
||||
# -e '/@uptime_y/ s/@uptime_d/@uptime_dy/g' \
|
||||
# -e 's/#\{(\?)?uptime_h/#\{\1@uptime_h/g' \
|
||||
# -e 's/#\{(\?)?uptime_m/#\{\1@uptime_m/g' \
|
||||
# -e 's/#\{(\?)?uptime_s/#\{\1@uptime_s/g')
|
||||
|
|
|
@ -172,13 +172,14 @@ tmux_conf_theme_right_separator_sub='|'
|
|||
# - #{prefix}
|
||||
# - #{root}
|
||||
# - #{synchronized}
|
||||
# - #{uptime_d}
|
||||
# - #{uptime_y}
|
||||
# - #{uptime_d} (modulo 365 when #{uptime_y} is used)
|
||||
# - #{uptime_h}
|
||||
# - #{uptime_m}
|
||||
# - #{uptime_s}
|
||||
# - #{username}
|
||||
# - #{username_ssh}
|
||||
tmux_conf_theme_status_left=' ❐ #S | ↑#{?uptime_d, #{uptime_d}d,}#{?uptime_h, #{uptime_h}h,}#{?uptime_m, #{uptime_m}m,} '
|
||||
tmux_conf_theme_status_left=' ❐ #S | ↑#{?uptime_y, #{uptime_y}y,}#{?uptime_d, #{uptime_d}d,}#{?uptime_h, #{uptime_h}h,}#{?uptime_m, #{uptime_m}m,} '
|
||||
tmux_conf_theme_status_right='#{prefix}#{pairing}#{synchronized} #{?battery_status, #{battery_status},}#{?battery_bar, #{battery_bar},}#{?battery_percentage, #{battery_percentage},} , %R , %d %b | #{username}#{root} | #{hostname} '
|
||||
|
||||
# status left style
|
||||
|
|
|
@ -251,7 +251,8 @@ This configuration supports the following builtin variables:
|
|||
- `#{prefix}`: is prefix being depressed?
|
||||
- `#{root}`: is current user root?
|
||||
- `#{synchronized}`: are the panes synchronized?
|
||||
- `#{uptime_d}`: uptime days
|
||||
- `#{uptime_y}`: uptime years
|
||||
- `#{uptime_d}`: uptime days, modulo 365 when `#{uptime_y}` is used
|
||||
- `#{uptime_h}`: uptime hours
|
||||
- `#{uptime_m}`: uptime minutes
|
||||
- `#{uptime_s}`: uptime seconds
|
||||
|
|
Loading…
Reference in a new issue