worked around tmux not killing jobs launched with run-shell -b, fixes #407

upon exiting, tmux < 3.2 waits for jobs ran with run-shell, even those
launched with -b

the workaround consists in still launching "heavy" jobs from the status
line with #() even though it means e.g. battery information will get
updated once per attached client
This commit is contained in:
Gregory Pakosz 2020-09-26 17:36:29 +02:00
parent 67d1c23dca
commit a439667d65
1 changed files with 18 additions and 4 deletions

View File

@ -190,6 +190,8 @@ run -b '[ -z "#{window_active}" ] && [ -z "#{version}" ] && tmux set display-tim
#
# _uname_s=$(uname -s)
#
# _tmux_version=$(tmux -V | tr -cd '[:digit:].' | awk -F '.' '{print $1 * 100 + $2}')
#
# _is_enabled() {
# [ x"$1" = x"true" ] || [ x"$1" = x"yes" ] || [ x"$1" = x"enabled" ] || [ x"$1" = x"1" ]
# }
@ -1126,9 +1128,13 @@ run -b '[ -z "#{window_active}" ] && [ -z "#{version}" ] && tmux set display-tim
# -e 's/#\{(\?)?battery_vbar/#\{\1@battery_vbar/g' \
# -e 's/#\{(\?)?battery_status/#\{\1@battery_status/g' \
# -e 's/#\{(\?)?battery_percentage/#\{\1@battery_percentage/g')
# interval=60
# 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"
# 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
# if [ $_tmux_version -ge 302 ]; 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"
# else
# 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"
# fi
# ;;
# esac
# fi
@ -1171,7 +1177,11 @@ run -b '[ -z "#{window_active}" ] && [ -z "#{version}" ] && tmux set display-tim
# interval=$(tmux show -gv status-interval)
# ;;
# esac
# tmux run -b "trap 'exit 0' TERM; while :; do nice cut -c3- ~/.tmux.conf | sh -s _uptime; sleep $interval; done"
# if [ $_tmux_version -ge 302 ]; then
# tmux run -b "trap 'exit 0' TERM; while :; do nice cut -c3- ~/.tmux.conf | sh -s _uptime; sleep $interval; done"
# else
# status_right="#(printf '\n'; while :; do nice cut -c3- ~/.tmux.conf | sh -s _uptime; sleep $interval; done)$status_right"
# fi
# ;;
# esac
#
@ -1183,7 +1193,11 @@ run -b '[ -z "#{window_active}" ] && [ -z "#{version}" ] && tmux set display-tim
# status_right=$(echo "$status_right" | sed -E \
# -e 's/#\{(\?)?loadavg/#\{\1@loadavg/g')
# interval=$(tmux show -gv status-interval)
# tmux run -b "trap 'exit 0' TERM; while :; do nice cut -c3- ~/.tmux.conf | sh -s _loadavg; sleep $interval; done"
# if [ $_tmux_version -ge 302 ]; then
# tmux run -b "trap 'exit 0' TERM; while :; do nice cut -c3- ~/.tmux.conf | sh -s _loadavg; sleep $interval; done"
# else
# status_right="#(printf '\n'; while :; do nice cut -c3- ~/.tmux.conf | sh -s _loadavg; sleep $interval; done)$status_right"
# fi
# ;;
# esac
#