1
0
Fork 0
mirror of synced 2024-12-04 06:35:37 -05:00

removed x-prefix in [ x"..." = x"..." ] comparisons as all modern shells behave correctly

This commit is contained in:
Gregory Pakosz 2024-11-22 10:05:51 +01:00
parent 2e419db5d9
commit 9905544608

View file

@ -144,7 +144,7 @@ bind P choose-buffer # choose which buffer to paste from
# -- 8< ------------------------------------------------------------------------
%if #{==:#{TMUX_PROGRAM},}
run "exec sh -c 'TMUX_PROGRAM=\"\$(LSOF=\$(PATH=\"\$PATH:/usr/local/bin:/usr/bin:/bin:/usr/sbin:/sbin\" command -v lsof); \$LSOF -b -w -a -d txt -p #{pid} -Fn 2>/dev/null | perl -n -e \"if (s/^n((?:.(?!dylib\$|so\$))+)\$/\\1/g && s/(?:\s+\\([^\\s]+?\\))?\$//g) { print; exit } } exit 1; {\" 2>/dev/null || readlink \"/proc/#{pid}/exe\" 2>/dev/null)\"; [ x\"\$(\"\$TMUX_PROGRAM\" display -p \"#{l:#{pid}}\" 2>/dev/null)\" = x\"#{pid}\" ] || TMUX_PROGRAM=\"\$(command -v tmux || printf tmux)\"; \"\$TMUX_PROGRAM\" -S #{socket_path} set-environment -g TMUX_PROGRAM \"\$TMUX_PROGRAM\"'"
run "exec sh -c 'TMUX_PROGRAM=\"\$(LSOF=\$(PATH=\"\$PATH:/usr/local/bin:/usr/bin:/bin:/usr/sbin:/sbin\" command -v lsof); \$LSOF -b -w -a -d txt -p #{pid} -Fn 2>/dev/null | perl -n -e \"if (s/^n((?:.(?!dylib\$|so\$))+)\$/\\1/g && s/(?:\s+\\([^\\s]+?\\))?\$//g) { print; exit } } exit 1; {\" 2>/dev/null || readlink \"/proc/#{pid}/exe\" 2>/dev/null)\"; [ \"\$(\"\$TMUX_PROGRAM\" display -p \"#{l:#{pid}}\" 2>/dev/null)\" = \"#{pid}\" ] || TMUX_PROGRAM=\"\$(command -v tmux || printf tmux)\"; \"\$TMUX_PROGRAM\" -S #{socket_path} set-environment -g TMUX_PROGRAM \"\$TMUX_PROGRAM\"'"
%endif
%if #{==:#{TMUX_SOCKET},}
run "exec sh -c '\"\$TMUX_PROGRAM\" -S #{socket_path} set-environment -g TMUX_SOCKET \"#{socket_path}\"'"
@ -1500,11 +1500,11 @@ run 'cut -c3- "$TMUX_CONF" | sh -s _apply_configuration'
# status_right="#(echo; 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" -eq 3500 ]; then
# tmux run -b "exec sh -c 'trap \"[ -n \\\\\"\\\\\$sleep_pid\\\\\" ] && kill -9 \\\\\"\\\\\$sleep_pid\\\\\"; exit 0\" TERM; while [ x\"\$(\"$TMUX_PROGRAM\" -S \"#{socket_path}\" display -p \"#{l:#{pid}}\")\" = x\"#{pid}\" ]; do nice cut -c3- \"$TMUX_CONF\" | sh -s _battery_info; sleep $interval & sleep_pid=\$!; wait \"\$sleep_pid\"; sleep_pid=; done'"
# tmux run -b "exec sh -c 'trap \"[ -n \\\\\"\\\\\$sleep_pid\\\\\" ] && kill -9 \\\\\"\\\\\$sleep_pid\\\\\"; exit 0\" TERM; while [ \"\$(\"$TMUX_PROGRAM\" -S \"#{socket_path}\" display -p \"#{l:#{pid}}\")\" = \"#{pid}\" ]; do nice cut -c3- \"$TMUX_CONF\" | sh -s _battery_info; sleep $interval & sleep_pid=\$!; wait \"\$sleep_pid\"; sleep_pid=; done'"
# elif [ "$_tmux_version" -ge 3200 ]; then
# tmux run -b "trap '[ -n \"\$sleep_pid\" ] && kill -9 \"\$sleep_pid\"; exit 0' TERM; while [ x\"\$(\"$TMUX_PROGRAM\" -S '#{socket_path}' display -p '#{l:#{pid}}')\" = x\"#{pid}\" ]; do nice cut -c3- '$TMUX_CONF' | sh -s _battery_info; sleep $interval & sleep_pid=\$!; wait \"\$sleep_pid\"; sleep_pid=; done"
# tmux run -b "trap '[ -n \"\$sleep_pid\" ] && kill -9 \"\$sleep_pid\"; exit 0' TERM; while [ \"\$(\"$TMUX_PROGRAM\" -S '#{socket_path}' display -p '#{l:#{pid}}')\" = \"#{pid}\" ]; do nice cut -c3- '$TMUX_CONF' | sh -s _battery_info; sleep $interval & sleep_pid=\$!; wait \"\$sleep_pid\"; sleep_pid=; done"
# elif [ "$_tmux_version" -ge 2800 ]; then
# status_right="#(echo; while [ x\"\$(\"$TMUX_PROGRAM\" -S '#{socket_path}' display -p '#{l:#{pid}}')\" = x\"#{pid}\" ]; do nice cut -c3- '$TMUX_CONF' | sh -s _battery_info; sleep $interval; done)$status_right"
# status_right="#(echo; while [ \"\$(\"$TMUX_PROGRAM\" -S '#{socket_path}' display -p '#{l:#{pid}}')\" = \"#{pid}\" ]; do nice cut -c3- '$TMUX_CONF' | sh -s _battery_info; sleep $interval; done)$status_right"
# elif [ "$_tmux_version" -gt 2400 ]; then
# status_right="#(echo; while :; do nice cut -c3- '$TMUX_CONF' | sh -s _battery_info; sleep $interval; done)$status_right"
# else
@ -1557,11 +1557,11 @@ run 'cut -c3- "$TMUX_CONF" | sh -s _apply_configuration'
# ;;
# esac
# if [ "$_tmux_version" -eq 3500 ]; then
# tmux run -b "exec sh -c 'trap \"[ -n \\\\\"\\\\\$sleep_pid\\\\\" ] && kill -9 \\\\\"\\\\\$sleep_pid\\\\\"; exit 0\" TERM; while [ x\"\$(\"$TMUX_PROGRAM\" -S \"#{socket_path}\" display -p \"#{l:#{pid}}\")\" = x\"#{pid}\" ]; do nice cut -c3- \"$TMUX_CONF\" | sh -s _uptime; sleep $interval & sleep_pid=\$!; wait \"\$sleep_pid\"; sleep_pid=; done'"
# tmux run -b "exec sh -c 'trap \"[ -n \\\\\"\\\\\$sleep_pid\\\\\" ] && kill -9 \\\\\"\\\\\$sleep_pid\\\\\"; exit 0\" TERM; while [ \"\$(\"$TMUX_PROGRAM\" -S \"#{socket_path}\" display -p \"#{l:#{pid}}\")\" = \"#{pid}\" ]; do nice cut -c3- \"$TMUX_CONF\" | sh -s _uptime; sleep $interval & sleep_pid=\$!; wait \"\$sleep_pid\"; sleep_pid=; done'"
# elif [ "$_tmux_version" -ge 3200 ]; then
# tmux run -b "trap '[ -n \"\$sleep_pid\" ] && kill -9 \"\$sleep_pid\"; exit 0' TERM; while [ x\"\$(\"$TMUX_PROGRAM\" -S '#{socket_path}' display -p '#{l:#{pid}}')\" = x\"#{pid}\" ]; do nice cut -c3- '$TMUX_CONF' | sh -s _uptime; sleep $interval & sleep_pid=\$!; wait \"\$sleep_pid\"; sleep_pid=; done"
# tmux run -b "trap '[ -n \"\$sleep_pid\" ] && kill -9 \"\$sleep_pid\"; exit 0' TERM; while [ \"\$(\"$TMUX_PROGRAM\" -S '#{socket_path}' display -p '#{l:#{pid}}')\" = \"#{pid}\" ]; do nice cut -c3- '$TMUX_CONF' | sh -s _uptime; sleep $interval & sleep_pid=\$!; wait \"\$sleep_pid\"; sleep_pid=; done"
# elif [ "$_tmux_version" -ge 2800 ]; then
# status_right="#(echo; while [ x\"\$(\"$TMUX_PROGRAM\" -S '#{socket_path}' display -p '#{l:#{pid}}')\" = x\"#{pid}\" ]; do nice cut -c3- '$TMUX_CONF' | sh -s _uptime; sleep $interval; done)$status_right"
# status_right="#(echo; while [ \"\$(\"$TMUX_PROGRAM\" -S '#{socket_path}' display -p '#{l:#{pid}}')\" = \"#{pid}\" ]; do nice cut -c3- '$TMUX_CONF' | sh -s _uptime; sleep $interval; done)$status_right"
# elif [ "$_tmux_version" -gt 2400 ]; then
# status_right="#(echo; while :; do nice cut -c3- '$TMUX_CONF' | sh -s _uptime; sleep $interval; done)$status_right"
# else
@ -1579,11 +1579,11 @@ run 'cut -c3- "$TMUX_CONF" | sh -s _apply_configuration'
# -e 's/#\{(\?)?loadavg/#\{\1@loadavg/g')
# interval=$(tmux show -gv status-interval)
# if [ "$_tmux_version" -eq 3500 ]; then
# tmux run -b "exec sh -c 'trap \"[ -n \\\\\"\\\\\$sleep_pid\\\\\" ] && kill -9 \\\\\"\\\\\$sleep_pid\\\\\"; exit 0\" TERM; while [ x\"\$(\"$TMUX_PROGRAM\" -S \"#{socket_path}\" display -p \"#{l:#{pid}}\")\" = x\"#{pid}\" ]; do nice cut -c3- \"$TMUX_CONF\" | sh -s _loadavg; sleep $interval & sleep_pid=\$!; wait \"\$sleep_pid\"; sleep_pid=; done'"
# tmux run -b "exec sh -c 'trap \"[ -n \\\\\"\\\\\$sleep_pid\\\\\" ] && kill -9 \\\\\"\\\\\$sleep_pid\\\\\"; exit 0\" TERM; while [ \"\$(\"$TMUX_PROGRAM\" -S \"#{socket_path}\" display -p \"#{l:#{pid}}\")\" = \"#{pid}\" ]; do nice cut -c3- \"$TMUX_CONF\" | sh -s _loadavg; sleep $interval & sleep_pid=\$!; wait \"\$sleep_pid\"; sleep_pid=; done'"
# elif [ "$_tmux_version" -ge 3200 ]; then
# tmux run -b "trap '[ -n \"\$sleep_pid\" ] && kill -9 \"\$sleep_pid\"; exit 0' TERM; while [ x\"\$(\"$TMUX_PROGRAM\" -S '#{socket_path}' display -p '#{l:#{pid}}')\" = x\"#{pid}\" ]; do nice cut -c3- '$TMUX_CONF' | sh -s _loadavg; sleep $interval & sleep_pid=\$!; wait \"\$sleep_pid\"; sleep_pid=; done"
# tmux run -b "trap '[ -n \"\$sleep_pid\" ] && kill -9 \"\$sleep_pid\"; exit 0' TERM; while [ \"\$(\"$TMUX_PROGRAM\" -S '#{socket_path}' display -p '#{l:#{pid}}')\" = \"#{pid}\" ]; do nice cut -c3- '$TMUX_CONF' | sh -s _loadavg; sleep $interval & sleep_pid=\$!; wait \"\$sleep_pid\"; sleep_pid=; done"
# elif [ "$_tmux_version" -ge 2800 ]; then
# status_right="#(echo; while [ x\"\$(\"$TMUX_PROGRAM\" -S '#{socket_path}' display -p '#{l:#{pid}}')\" = x\"#{pid}\" ]; do nice cut -c3- '$TMUX_CONF' | sh -s _loadavg; sleep $interval; done)$status_right"
# status_right="#(echo; while [ \"\$(\"$TMUX_PROGRAM\" -S '#{socket_path}' display -p '#{l:#{pid}}')\" = \"#{pid}\" ]; do nice cut -c3- '$TMUX_CONF' | sh -s _loadavg; sleep $interval; done)$status_right"
# elif [ "$_tmux_version" -gt 2400 ]; then
# status_right="#(echo; while :; do nice cut -c3- '$TMUX_CONF' | sh -s _loadavg; sleep $interval; done)$status_right"
# else