1
0
Fork 0
mirror of synced 2024-11-17 23:15:35 -05:00

launch tpm early if it's already present on the filesystem, resolves #713

This commit is contained in:
Gregory Pakosz 2024-01-31 14:27:24 +01:00
parent c318d0834f
commit fc4e3bc37b

View file

@ -1542,12 +1542,20 @@ run 'cut -c3- "$TMUX_CONF" | sh -s _apply_configuration'
# else
# if [ "$(command tmux display -p '#{pid} #{version} #{socket_path}')" = "$($TMUX_PROGRAM display -p '#{pid} #{version} #{socket_path}')" ]; then
# tpm_plugins=$(cat << EOF | tr ' ' '\n' | awk '/^\s*$/ {next;}; !seen[$0]++ { gsub(/^[ \t]+/,"",$0); gsub(/[ \t]+$/,"",$0); print $0 }'
# "$tpm_plugins"
# $tpm_plugins
# $(awk '/^[ \t]*set(-option)?.*[ \t]@plugin[ \t]/ { gsub(/'\''/, ""); gsub(/'\"'/, ""); print $NF }' "$TMUX_CONF_LOCAL" 2>/dev/null)
# EOF
# )
# tmux set-environment -g TMUX_PLUGIN_MANAGER_PATH "$TMUX_PLUGIN_MANAGER_PATH"
# tmux set -g '@tpm_plugins' "$tpm_plugins"
#
# if [ -d "$TMUX_PLUGIN_MANAGER_PATH/tpm" ]; then
# [ -z "$(tmux show -gqv '@tpm-install')" ] && tmux set -g '@tpm-install' 'I'
# [ -z "$(tmux show -gqv '@tpm-update')" ] && tmux set -g '@tpm-update' 'u'
# [ -z "$(tmux show -gqv '@tpm-clean')" ] && tmux set -g '@tpm-clean' 'M-u'
# "$TMUX_PLUGIN_MANAGER_PATH/tpm/tpm" || tmux display "One or more tpm plugin(s) failed"
# fi
#
# if git ls-remote -hq https://github.com/gpakosz/.tmux.git master > /dev/null; then
# if [ ! -d "$TMUX_PLUGIN_MANAGER_PATH/tpm" ]; then
# install_tpm=true
@ -1566,29 +1574,41 @@ run 'cut -c3- "$TMUX_CONF" | sh -s _apply_configuration'
# fi
# if [ "$update_tpm" = "true" ]; then
# {
# echo "Invoking $TMUX_PLUGIN_MANAGER_PATH/tpm/bin/install_plugins ..." > "$TMUX_PLUGIN_MANAGER_PATH/tpm_log.txt" 2>&1 && \
# "$TMUX_PLUGIN_MANAGER_PATH/tpm/bin/install_plugins" >> "$TMUX_PLUGIN_MANAGER_PATH/tpm_log.txt" 2>&1 &&\
# echo "Invoking $TMUX_PLUGIN_MANAGER_PATH/tpm/bin/update_plugins all ..." > "$TMUX_PLUGIN_MANAGER_PATH/tpm_log.txt" 2>&1 && \
# "$TMUX_PLUGIN_MANAGER_PATH/tpm/bin/update_plugins" all >> "$TMUX_PLUGIN_MANAGER_PATH/tpm_log.txt" 2>&1 &&\
# echo "Invoking $TMUX_PLUGIN_MANAGER_PATH/tpm/bin/clean_plugins all ..." > "$TMUX_PLUGIN_MANAGER_PATH/tpm_log.txt" 2>&1 && \
# "$TMUX_PLUGIN_MANAGER_PATH/tpm/bin/clean_plugins" all >> "$TMUX_PLUGIN_MANAGER_PATH/tpm_log.txt" 2>&1 &&\
# {
# printf 'List of discovered tpm plugins: %s\n' "$(printf '%s\n' "$tpm_plugins" | paste -s -d ' ' -)" | perl -MPOSIX=strftime -MTime::HiRes=gettimeofday -pe 'my ($s, $us) = gettimeofday(); printf ("[%s.%03d]\t ", strftime("%Y-%m-%d %H:%M:%S", localtime $s), $us / 1000)'
# printf '%s\n' "Invoking $TMUX_PLUGIN_MANAGER_PATH/tpm/bin/install_plugins" | perl -MPOSIX=strftime -MTime::HiRes=gettimeofday -pe 'my ($s, $us) = gettimeofday(); printf ("[%s.%03d]\t ", strftime("%Y-%m-%d %H:%M:%S", localtime $s), $us / 1000)'
# "$TMUX_PLUGIN_MANAGER_PATH/tpm/bin/install_plugins" 2>&1 | perl -MPOSIX=strftime -MTime::HiRes=gettimeofday -pe 'my ($s, $us) = gettimeofday(); printf ("[%s.%03d]\t ", strftime("%Y-%m-%d %H:%M:%S", localtime $s), $us / 1000)'
# printf '%s\n' "Invoking $TMUX_PLUGIN_MANAGER_PATH/tpm/bin/update_plugins all" | perl -MPOSIX=strftime -MTime::HiRes=gettimeofday -pe 'my ($s, $us) = gettimeofday(); printf ("[%s.%03d]\t ", strftime("%Y-%m-%d %H:%M:%S", localtime $s), $us / 1000)'
# "$TMUX_PLUGIN_MANAGER_PATH/tpm/bin/update_plugins" all 2>&1 | perl -MPOSIX=strftime -MTime::HiRes=gettimeofday -pe 'my ($s, $us) = gettimeofday(); printf ("[%s.%03d]\t ", strftime("%Y-%m-%d %H:%M:%S", localtime $s), $us / 1000)'
# printf '%s\n' "Invoking $TMUX_PLUGIN_MANAGER_PATH/tpm/bin/clean_plugins all" | perl -MPOSIX=strftime -MTime::HiRes=gettimeofday -pe 'my ($s, $us) = gettimeofday(); printf ("[%s.%03d]\t ", strftime("%Y-%m-%d %H:%M:%S", localtime $s), $us / 1000)'
# "$TMUX_PLUGIN_MANAGER_PATH/tpm/bin/clean_plugins" all 2>&1 | perl -MPOSIX=strftime -MTime::HiRes=gettimeofday -pe 'my ($s, $us) = gettimeofday(); printf ("[%s.%03d]\t ", strftime("%Y-%m-%d %H:%M:%S", localtime $s), $us / 1000)'
# printf 'Done.\n' | perl -MPOSIX=strftime -MTime::HiRes=gettimeofday -pe 'my ($s, $us) = gettimeofday(); printf ("[%s.%03d]\t ", strftime("%Y-%m-%d %H:%M:%S", localtime $s), $us / 1000)'
# printf '\n'
# } >> "$TMUX_PLUGIN_MANAGER_PATH/tpm_log.txt"
#
# tmux display 'Done updating tpm and plugins...'
# } || tmux display 'Failed updating tpm and plugins...'
# elif [ "$install_tpm" = "true" ]; then
# {
# echo "Invoking $TMUX_PLUGIN_MANAGER_PATH/tpm/bin/install_plugins ..." > "$TMUX_PLUGIN_MANAGER_PATH/tpm_log.txt" 2>&1 && \
# "$TMUX_PLUGIN_MANAGER_PATH/tpm/bin/install_plugins" >> "$TMUX_PLUGIN_MANAGER_PATH/tpm_log.txt" 2>&1
# {
# printf 'List of discovered tpm plugins: %s\n' "$(printf '%s\n' "$tpm_plugins" | paste -s -d ' ' -)" | perl -MPOSIX=strftime -MTime::HiRes=gettimeofday -pe 'my ($s, $us) = gettimeofday(); printf ("[%s.%03d]\t ", strftime("%Y-%m-%d %H:%M:%S", localtime $s), $us / 1000)'
# printf '%s\n' "Invoking $TMUX_PLUGIN_MANAGER_PATH/tpm/bin/install_plugins" | perl -MPOSIX=strftime -MTime::HiRes=gettimeofday -pe 'my ($s, $us) = gettimeofday(); printf ("[%s.%03d]\t ", strftime("%Y-%m-%d %H:%M:%S", localtime $s), $us / 1000)'
# "$TMUX_PLUGIN_MANAGER_PATH/tpm/bin/install_plugins" 2>&1 | perl -MPOSIX=strftime -MTime::HiRes=gettimeofday -pe 'my ($s, $us) = gettimeofday(); printf ("[%s.%03d]\t ", strftime("%Y-%m-%d %H:%M:%S", localtime $s), $us / 1000)'
# printf 'Done.\n' | perl -MPOSIX=strftime -MTime::HiRes=gettimeofday -pe 'my ($s, $us) = gettimeofday(); printf ("[%s.%03d]\t ", strftime("%Y-%m-%d %H:%M:%S", localtime $s), $us / 1000)'
# printf '\n' >> "$TMUX_PLUGIN_MANAGER_PATH/tpm_log.txt"
# } >> "$TMUX_PLUGIN_MANAGER_PATH/tpm_log.txt"
#
# tmux display 'Done installing tpm and plugins...'
#
# [ -z "$(tmux show -gqv '@tpm-install')" ] && tmux set -g '@tpm-install' 'I'
# [ -z "$(tmux show -gqv '@tpm-update')" ] && tmux set -g '@tpm-update' 'u'
# [ -z "$(tmux show -gqv '@tpm-clean')" ] && tmux set -g '@tpm-clean' 'M-u'
# "$TMUX_PLUGIN_MANAGER_PATH/tpm/tpm" || tmux display "One or more tpm plugin(s) failed"
# } || tmux display 'Failed installing tpm and plugins...'
# fi
# else
# tmux display "GitHub doesn't seem to be reachable, skipping installing and/or updating tpm and plugins..."
# fi
#
# [ -z "$(tmux show -gqv '@tpm-install')" ] && tmux set -g '@tpm-install' 'I'
# [ -z "$(tmux show -gqv '@tpm-update')" ] && tmux set -g '@tpm-update' 'u'
# [ -z "$(tmux show -gqv '@tpm-clean')" ] && tmux set -g '@tpm-clean' 'M-u'
# "$TMUX_PLUGIN_MANAGER_PATH/tpm/tpm" || tmux display "One or more tpm plugin(s) failed"
# else
# tmux run -b "sleep \$((#{display-time} / 1000)) && '$TMUX_PROGRAM' set display-time 3000 \; display 'Cannot use tpm which assumes a globally installed tmux' \; set -u display-time"
# fi