Use display-message for progress

This commit is contained in:
jaclu 2022-04-15 01:41:08 +02:00
parent b699a7e01c
commit 0b01d75cb0
5 changed files with 23 additions and 0 deletions

View File

@ -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

View File

@ -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() {

View File

@ -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
}

View File

@ -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

View File

@ -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 "$*"