1
0
Fork 0
mirror of synced 2024-12-22 06:41:07 -05:00

made version detection more robust in case tmux executable is renamed (2), fixes #457

This commit is contained in:
Gregory Pakosz 2021-03-04 08:15:45 +01:00
parent 4868ac4bd9
commit 8aefa1e798

View file

@ -189,7 +189,7 @@ run 'cut -c3- ~/.tmux.conf | sh -s _apply_configuration'
# #
# _uname_s=$(uname -s) # _uname_s=$(uname -s)
# #
# _tmux_version=$(tmux -V | tr -cd '0123456789.' | cut -d' ' -f2 | awk -F '.' '{print $1 * 100 + $2}') # _tmux_version=$(tmux -V | awk '{print ($2+0) * 100}')
# #
# _is_enabled() { # _is_enabled() {
# [ x"$1" = x"true" ] || [ x"$1" = x"yes" ] || [ x"$1" = x"enabled" ] || [ x"$1" = x"1" ] # [ x"$1" = x"true" ] || [ x"$1" = x"yes" ] || [ x"$1" = x"enabled" ] || [ x"$1" = x"1" ]
@ -1211,9 +1211,9 @@ run 'cut -c3- ~/.tmux.conf | sh -s _apply_configuration'
# -e 's/#\{(\?)?battery_percentage/#\{\1@battery_percentage/g') # -e 's/#\{(\?)?battery_percentage/#\{\1@battery_percentage/g')
# status_right="#(printf '\n'; nice cut -c3- ~/.tmux.conf | sh -s _battery_status \"$tmux_conf_battery_status_charging\" \"$tmux_conf_battery_status_discharging\")$status_right" # status_right="#(printf '\n'; nice cut -c3- ~/.tmux.conf | sh -s _battery_status \"$tmux_conf_battery_status_charging\" \"$tmux_conf_battery_status_discharging\")$status_right"
# interval=60 # interval=60
# if [ $_tmux_version -ge 302 ]; then # if [ $_tmux_version -ge 320 ]; then
# tmux run -b "trap 'exit 0' TERM; while :; do nice cut -c3- ~/.tmux.conf | sh -s _battery_bar \"$tmux_conf_battery_bar_symbol_full\" \"$tmux_conf_battery_bar_symbol_empty\" \"$tmux_conf_battery_bar_length\" \"$tmux_conf_battery_bar_palette\" \"$tmux_conf_battery_hbar_palette\" \"$tmux_conf_battery_vbar_palette\"; sleep $interval; done" # tmux run -b "trap 'exit 0' TERM; while :; do nice cut -c3- ~/.tmux.conf | sh -s _battery_bar \"$tmux_conf_battery_bar_symbol_full\" \"$tmux_conf_battery_bar_symbol_empty\" \"$tmux_conf_battery_bar_length\" \"$tmux_conf_battery_bar_palette\" \"$tmux_conf_battery_hbar_palette\" \"$tmux_conf_battery_vbar_palette\"; sleep $interval; done"
# elif [ $_tmux_version -gt 204 ]; then # elif [ $_tmux_version -gt 240 ]; then
# status_right="#(printf '\n'; while :; do nice cut -c3- ~/.tmux.conf | sh -s _battery_bar \"$tmux_conf_battery_bar_symbol_full\" \"$tmux_conf_battery_bar_symbol_empty\" \"$tmux_conf_battery_bar_length\" \"$tmux_conf_battery_bar_palette\" \"$tmux_conf_battery_hbar_palette\" \"$tmux_conf_battery_vbar_palette\"; sleep $interval; done)$status_right" # status_right="#(printf '\n'; while :; do nice cut -c3- ~/.tmux.conf | sh -s _battery_bar \"$tmux_conf_battery_bar_symbol_full\" \"$tmux_conf_battery_bar_symbol_empty\" \"$tmux_conf_battery_bar_length\" \"$tmux_conf_battery_bar_palette\" \"$tmux_conf_battery_hbar_palette\" \"$tmux_conf_battery_vbar_palette\"; sleep $interval; done)$status_right"
# else # else
# status_right="#(nice cut -c3- ~/.tmux.conf | sh -s _battery_bar \"$tmux_conf_battery_bar_symbol_full\" \"$tmux_conf_battery_bar_symbol_empty\" \"$tmux_conf_battery_bar_length\" \"$tmux_conf_battery_bar_palette\" \"$tmux_conf_battery_hbar_palette\" \"$tmux_conf_battery_vbar_palette\")$status_right" # status_right="#(nice cut -c3- ~/.tmux.conf | sh -s _battery_bar \"$tmux_conf_battery_bar_symbol_full\" \"$tmux_conf_battery_bar_symbol_empty\" \"$tmux_conf_battery_bar_length\" \"$tmux_conf_battery_bar_palette\" \"$tmux_conf_battery_hbar_palette\" \"$tmux_conf_battery_vbar_palette\")$status_right"
@ -1264,9 +1264,9 @@ run 'cut -c3- ~/.tmux.conf | sh -s _apply_configuration'
# interval=$(tmux show -gv status-interval) # interval=$(tmux show -gv status-interval)
# ;; # ;;
# esac # esac
# if [ $_tmux_version -ge 302 ]; then # if [ $_tmux_version -ge 320 ]; then
# tmux run -b "trap 'exit 0' TERM; while :; do nice cut -c3- ~/.tmux.conf | sh -s _uptime; sleep $interval; done" # tmux run -b "trap 'exit 0' TERM; while :; do nice cut -c3- ~/.tmux.conf | sh -s _uptime; sleep $interval; done"
# elif [ $_tmux_version -gt 204 ]; then # elif [ $_tmux_version -gt 240 ]; then
# status_right="#(printf '\n'; while :; do nice cut -c3- ~/.tmux.conf | sh -s _uptime; sleep $interval; done)$status_right" # status_right="#(printf '\n'; while :; do nice cut -c3- ~/.tmux.conf | sh -s _uptime; sleep $interval; done)$status_right"
# else # else
# status_right="#(nice cut -c3- ~/.tmux.conf | sh -s _uptime)$status_right" # status_right="#(nice cut -c3- ~/.tmux.conf | sh -s _uptime)$status_right"
@ -1282,9 +1282,9 @@ run 'cut -c3- ~/.tmux.conf | sh -s _apply_configuration'
# status_right=$(echo "$status_right" | sed -E \ # status_right=$(echo "$status_right" | sed -E \
# -e 's/#\{(\?)?loadavg/#\{\1@loadavg/g') # -e 's/#\{(\?)?loadavg/#\{\1@loadavg/g')
# interval=$(tmux show -gv status-interval) # interval=$(tmux show -gv status-interval)
# if [ $_tmux_version -ge 302 ]; then # if [ $_tmux_version -ge 320 ]; then
# tmux run -b "trap 'exit 0' TERM; while :; do nice cut -c3- ~/.tmux.conf | sh -s _loadavg; sleep $interval; done" # tmux run -b "trap 'exit 0' TERM; while :; do nice cut -c3- ~/.tmux.conf | sh -s _loadavg; sleep $interval; done"
# elif [ $_tmux_version -gt 204 ]; then # elif [ $_tmux_version -gt 240 ]; then
# status_right="#(printf '\n'; while :; do nice cut -c3- ~/.tmux.conf | sh -s _loadavg; sleep $interval; done)$status_right" # status_right="#(printf '\n'; while :; do nice cut -c3- ~/.tmux.conf | sh -s _loadavg; sleep $interval; done)$status_right"
# else # else
# status_right="#(nice cut -c3- ~/.tmux.conf | sh -s _loadavg)$status_right" # status_right="#(nice cut -c3- ~/.tmux.conf | sh -s _loadavg)$status_right"
@ -1360,7 +1360,7 @@ run 'cut -c3- ~/.tmux.conf | sh -s _apply_configuration'
# tmux display 'Done installing tpm and plugins...' # tmux display 'Done installing tpm and plugins...'
# fi # fi
# "$TMUX_PLUGIN_MANAGER_PATH/tpm/tpm" # "$TMUX_PLUGIN_MANAGER_PATH/tpm/tpm"
# if [ -z "$window_active" ] && [ $_tmux_version -lt 204 ]; then # if [ -z "$window_active" ] && [ $_tmux_version -lt 240 ]; then
# tmux run -b "sleep $(expr $(tmux display -p '#{display-time}') / 500) && tmux set display-time 3000 \; display 'This configuration will soon require tmux 2.4+' \; set -u display-time" # tmux run -b "sleep $(expr $(tmux display -p '#{display-time}') / 500) && tmux set display-time 3000 \; display 'This configuration will soon require tmux 2.4+' \; set -u display-time"
# fi # fi
# } # }
@ -1371,7 +1371,7 @@ run 'cut -c3- ~/.tmux.conf | sh -s _apply_configuration'
# if [ -n "$(tmux show -gv '@plugin')" ] || [ -n "$(tmux show -gv '@tpm_plugins')" ]; then # if [ -n "$(tmux show -gv '@plugin')" ] || [ -n "$(tmux show -gv '@tpm_plugins')" ]; then
# tmux run -b "cut -c3- ~/.tmux.conf | sh -s __apply_plugins \"$window_active\" \"$tmux_conf_update_plugins_on_launch\" \"$tmux_conf_update_plugins_on_reload\"" # tmux run -b "cut -c3- ~/.tmux.conf | sh -s __apply_plugins \"$window_active\" \"$tmux_conf_update_plugins_on_launch\" \"$tmux_conf_update_plugins_on_reload\""
# elif [ -z "$window_active" ]; then # elif [ -z "$window_active" ]; then
# if [ $_tmux_version -lt 204 ]; then # if [ $_tmux_version -lt 240 ]; then
# tmux run -b 'tmux set display-time 3000 \; display "This configuration will soon require tmux 2.4+" \; set -u display-time' # tmux run -b 'tmux set display-time 3000 \; display "This configuration will soon require tmux 2.4+" \; set -u display-time'
# fi # fi
# fi # fi
@ -1393,7 +1393,7 @@ run 'cut -c3- ~/.tmux.conf | sh -s _apply_configuration'
# tmux run -b 'tmux set display-time 3000 \; display "This configuration requires awk" \; set -u display-time \; run "sleep 3" \; kill-server' # tmux run -b 'tmux set display-time 3000 \; display "This configuration requires awk" \; set -u display-time \; run "sleep 3" \; kill-server'
# return # return
# fi # fi
# if [ $_tmux_version -lt 203 ]; then # if [ $_tmux_version -lt 230 ]; then
# tmux run -b 'tmux set display-time 3000 \; display "This configuration requires tmux 2.3+" \; set -u display-time \; run "sleep 3" \; kill-server' # tmux run -b 'tmux set display-time 3000 \; display "This configuration requires tmux 2.3+" \; set -u display-time \; run "sleep 3" \; kill-server'
# return # return
# fi # fi