From 0b01d75cb09759c6dc462cd653449491398d2d35 Mon Sep 17 00:00:00 2001 From: jaclu Date: Fri, 15 Apr 2022 01:41:08 +0200 Subject: [PATCH 1/2] Use display-message for progress --- scripts/clean_plugins.sh | 2 ++ scripts/helpers/tmux_echo_functions.sh | 2 ++ scripts/helpers/utility.sh | 15 +++++++++++++++ scripts/install_plugins.sh | 2 ++ scripts/update_plugin.sh | 2 ++ 5 files changed, 23 insertions(+) diff --git a/scripts/clean_plugins.sh b/scripts/clean_plugins.sh index a025524..2c35e25 100755 --- a/scripts/clean_plugins.sh +++ b/scripts/clean_plugins.sh @@ -34,8 +34,10 @@ clean_plugins() { } main() { + set_long_tmux_display_time ensure_tpm_path_exists clean_plugins + tmux set-option -g display-time "$org_display_time" # Restore display-time exit_value_helper } main diff --git a/scripts/helpers/tmux_echo_functions.sh b/scripts/helpers/tmux_echo_functions.sh index 7a6ef0a..1e6fc52 100644 --- a/scripts/helpers/tmux_echo_functions.sh +++ b/scripts/helpers/tmux_echo_functions.sh @@ -4,6 +4,7 @@ _has_emacs_mode_keys() { tmux_echo() { local message="$1" + tmux display-message "$message" tmux run-shell "echo '$message'" } @@ -13,6 +14,7 @@ echo_ok() { echo_err() { tmux_echo "$*" + sleep 3 # Give some time for error message to be displayed in status bar } end_message() { diff --git a/scripts/helpers/utility.sh b/scripts/helpers/utility.sh index de6eb35..85a29cf 100644 --- a/scripts/helpers/utility.sh +++ b/scripts/helpers/utility.sh @@ -15,3 +15,18 @@ exit_value_helper() { exit 0 fi } + +set_long_tmux_display_time() { + # + # Since tmux display is used to indicate progress, save original + # display-time and temporarily set it to 2 minutes. + # New messages will overwrite previous, so this is not blocking anything. + # It is just a random long time to ensure that the messages don't time-out. + # + # Use this to restore the original display-time before exiting: + # + # tmux set-option -g display-time "$org_display_time" + # + org_display_time="$(tmux show-options -g display-time | awk '{print $2}')" + tmux set-option -g display-time 120000 +} diff --git a/scripts/install_plugins.sh b/scripts/install_plugins.sh index e2450ac..c393f9a 100755 --- a/scripts/install_plugins.sh +++ b/scripts/install_plugins.sh @@ -67,9 +67,11 @@ verify_tpm_path_permissions() { } main() { + set_long_tmux_display_time ensure_tpm_path_exists verify_tpm_path_permissions install_plugins + tmux set-option -g display-time "$org_display_time" # Restore display-time exit_value_helper } main diff --git a/scripts/update_plugin.sh b/scripts/update_plugin.sh index 68bf605..15e2dc0 100755 --- a/scripts/update_plugin.sh +++ b/scripts/update_plugin.sh @@ -62,12 +62,14 @@ update_plugins() { } main() { + set_long_tmux_display_time ensure_tpm_path_exists if [ "$1" == "all" ]; then update_all else update_plugins "$*" fi + tmux set-option -g display-time "$org_display_time" # Restore display-time exit_value_helper } main "$*" From 838bb3285392d549d6303da9ebb8c52b09c326c0 Mon Sep 17 00:00:00 2001 From: jaclu Date: Fri, 15 Apr 2022 01:42:02 +0200 Subject: [PATCH 2/2] Remove empty lines that clears display-messages --- bindings/update_plugins | 1 - scripts/update_plugin.sh | 1 - 2 files changed, 2 deletions(-) diff --git a/bindings/update_plugins b/bindings/update_plugins index 28cc281..0c8c3cf 100755 --- a/bindings/update_plugins +++ b/bindings/update_plugins @@ -18,7 +18,6 @@ source "$HELPERS_DIR/tmux_utils.sh" display_plugin_update_list() { local plugins="$(tpm_plugins_list_helper)" tmux_echo "Installed plugins:" - tmux_echo "" for plugin in $plugins; do # displaying only installed plugins diff --git a/scripts/update_plugin.sh b/scripts/update_plugin.sh index 15e2dc0..ef46f92 100755 --- a/scripts/update_plugin.sh +++ b/scripts/update_plugin.sh @@ -34,7 +34,6 @@ update() { update_all() { echo_ok "Updating all plugins!" - echo_ok "" local plugins="$(tpm_plugins_list_helper)" for plugin in $plugins; do IFS='#' read -ra plugin <<< "$plugin"