diff --git a/.tmux.conf b/.tmux.conf index e334bd1..5996c7f 100644 --- a/.tmux.conf +++ b/.tmux.conf @@ -258,6 +258,31 @@ run 'cut -c3- "$TMUX_CONF" | sh -s _apply_configuration' # esac # fi # +# if perl -MTime::HiRes -e1; then +# _timestamp() { +# while IFS= read -r line; do +# printf '\t%s\n' "$line" | perl -MPOSIX=strftime -MTime::HiRes=gettimeofday -pe '($s, $us) = gettimeofday(); printf ("[%s.%03d]", strftime("%Y-%m-%d %H:%M:%S", localtime $s), $us / 1000)' +# done +# } +# else +# case "$_uname_s" in +# Darwin) +# _timestamp() { +# while IFS= read -r line; do +# printf '[%s]\t%s\n' "$(date +"%Y-%m-%d %H:%M:%S.000")" "$line" +# done +# } +# ;; +# *) +# _timestamp() { +# while IFS= read -r line; do +# printf '[%s]\t%s\n' "$(date +"%Y-%m-%d %H:%M:%S.%3N")" "$line" +# done +# } +# ;; +# esac +# fi +# # _bar() { # bar_palette=$(printf '%s' "$1" | tr ';' ',') # bar_symbol_empty=$2 @@ -1606,14 +1631,14 @@ run 'cut -c3- "$TMUX_CONF" | sh -s _apply_configuration' # if [ "$update_tpm" = "true" ]; then # { # { -# 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 'List of discovered tpm plugins: %s\n' "$(printf '%s\n' "$tpm_plugins" | paste -s -d ' ' -)" | _timestamp +# printf '%s\n' "Invoking $TMUX_PLUGIN_MANAGER_PATH/tpm/bin/install_plugins" | _timestamp +# "$TMUX_PLUGIN_MANAGER_PATH/tpm/bin/install_plugins" 2>&1 | _timestamp +# printf '%s\n' "Invoking $TMUX_PLUGIN_MANAGER_PATH/tpm/bin/update_plugins all" | _timestamp +# "$TMUX_PLUGIN_MANAGER_PATH/tpm/bin/update_plugins" all 2>&1 | _timestamp +# printf '%s\n' "Invoking $TMUX_PLUGIN_MANAGER_PATH/tpm/bin/clean_plugins all" | _timestamp +# "$TMUX_PLUGIN_MANAGER_PATH/tpm/bin/clean_plugins" all 2>&1 | _timestamp +# printf 'Done.\n' | _timestamp # printf '\n' # } >> "$TMUX_PLUGIN_MANAGER_PATH/tpm_log.txt" # @@ -1622,10 +1647,10 @@ run 'cut -c3- "$TMUX_CONF" | sh -s _apply_configuration' # elif [ "$install_tpm" = "true" ]; then # { # { -# 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 'List of discovered tpm plugins: %s\n' "$(printf '%s\n' "$tpm_plugins" | paste -s -d ' ' -)" | _timestamp +# printf '%s\n' "Invoking $TMUX_PLUGIN_MANAGER_PATH/tpm/bin/install_plugins" | _timestamp +# "$TMUX_PLUGIN_MANAGER_PATH/tpm/bin/install_plugins" 2>&1 | _timestamp +# printf 'Done.\n' | _timestamp # printf '\n' >> "$TMUX_PLUGIN_MANAGER_PATH/tpm_log.txt" # } >> "$TMUX_PLUGIN_MANAGER_PATH/tpm_log.txt" # @@ -1690,26 +1715,25 @@ run 'cut -c3- "$TMUX_CONF" | sh -s _apply_configuration' # _apply_configuration() { # window_active="$(tmux display -p '#{window_active}' 2>/dev/null || true)" # if [ -z "$window_active" ]; then -# if ! command -v perl > /dev/null 2>&1; then -# tmux run -b 'tmux set display-time 3000 \; display "This configuration requires perl" \; set -u display-time \; run "sleep 3" \; kill-server' -# return -# fi -# if ! perl -MTime::HiRes -e1 > /dev/null 2>&1; then -# tmux run -b 'tmux set display-time 3000 \; display "This configuration requires perl Time::HiRes" \; set -u display-time \; run "sleep 3" \; kill-server' -# return -# fi -# if ! command -v sed > /dev/null 2>&1; then -# tmux run -b 'tmux set display-time 3000 \; display "This configuration requires sed" \; set -u display-time \; run "sleep 3" \; kill-server' -# return -# fi -# if ! command -v awk > /dev/null 2>&1; then -# tmux run -b 'tmux set display-time 3000 \; display "This configuration requires awk" \; set -u display-time \; run "sleep 3" \; kill-server' -# return -# fi # if [ "$_tmux_version" -lt 2600 ]; then # tmux run -b 'tmux set display-time 3000 \; display "This configuration requires tmux 2.6+" \; set -u display-time \; run "sleep 3" \; kill-server' # return # fi +# if [ "$_tmux_version" -ge 3200 ]; then +# for cmd in perl sed awk; do +# if ! command -v "$cmd" > /dev/null 2>&1; then +# tmux run -b "tmux display -N -d 3000 'This configuration requires $cmd' \; run 'sleep 3' \; kill-server" +# return +# fi +# done +# else +# for cmd in perl sed awk; do +# if ! command -v "$cmd" > /dev/null 2>&1; then +# tmux run -b "tmux set display-time 3000 \; display 'This configuration requires $cmd' \; set -u display-time \; run 'sleep 3' \; kill-server" +# return +# fi +# done +# fi # fi # # case "$_uname_s" in