fix: add TMUX_CMD_PATH to handle the case of multiple tmux installation
This commit is contained in:
parent
60a36d6f7a
commit
d565659d46
3 changed files with 16 additions and 6 deletions
|
@ -11,6 +11,8 @@ CURRENT_DIR="$( cd "$( dirname "${BASH_SOURCE[0]}" )" && pwd )"
|
||||||
SCRIPTS_DIR="$CURRENT_DIR/../scripts"
|
SCRIPTS_DIR="$CURRENT_DIR/../scripts"
|
||||||
HELPERS_DIR="$SCRIPTS_DIR/helpers"
|
HELPERS_DIR="$SCRIPTS_DIR/helpers"
|
||||||
|
|
||||||
|
export TMUX_CMD_PATH=$(realpath "/proc/$(tmux display -p '#{pid}')/exe" 2> /dev/null || echo "tmux" | sed -z '$ s/\n$//')
|
||||||
|
|
||||||
source "$HELPERS_DIR/plugin_functions.sh"
|
source "$HELPERS_DIR/plugin_functions.sh"
|
||||||
source "$HELPERS_DIR/tmux_echo_functions.sh"
|
source "$HELPERS_DIR/tmux_echo_functions.sh"
|
||||||
source "$HELPERS_DIR/tmux_utils.sh"
|
source "$HELPERS_DIR/tmux_utils.sh"
|
||||||
|
@ -36,7 +38,7 @@ display_plugin_update_list() {
|
||||||
}
|
}
|
||||||
|
|
||||||
update_plugin_prompt() {
|
update_plugin_prompt() {
|
||||||
tmux command-prompt -p 'plugin update:' " \
|
$TMUX_CMD_PATH command-prompt -p 'plugin update:' " \
|
||||||
send-keys C-c; \
|
send-keys C-c; \
|
||||||
run-shell '$SCRIPTS_DIR/update_plugin_prompt_handler.sh %1'"
|
run-shell '$SCRIPTS_DIR/update_plugin_prompt_handler.sh %1'"
|
||||||
}
|
}
|
||||||
|
|
|
@ -3,6 +3,8 @@
|
||||||
VERSION="$1"
|
VERSION="$1"
|
||||||
UNSUPPORTED_MSG="$2"
|
UNSUPPORTED_MSG="$2"
|
||||||
|
|
||||||
|
export TMUX_CMD_PATH=$(realpath "/proc/$(tmux display -p '#{pid}')/exe" 2> /dev/null || echo "tmux" | sed -z '$ s/\n$//')
|
||||||
|
|
||||||
get_tmux_option() {
|
get_tmux_option() {
|
||||||
local option=$1
|
local option=$1
|
||||||
local default_value=$2
|
local default_value=$2
|
||||||
|
@ -30,13 +32,13 @@ display_message() {
|
||||||
local saved_display_time=$(get_tmux_option "display-time" "750")
|
local saved_display_time=$(get_tmux_option "display-time" "750")
|
||||||
|
|
||||||
# sets message display time to 5 seconds
|
# sets message display time to 5 seconds
|
||||||
tmux set-option -gq display-time "$display_duration"
|
$TMUX_CMD_PATH set-option -gq display-time "$display_duration"
|
||||||
|
|
||||||
# displays message
|
# displays message
|
||||||
tmux display-message "$message"
|
$TMUX_CMD_PATH display-message "$message"
|
||||||
|
|
||||||
# restores original 'display-time' value
|
# restores original 'display-time' value
|
||||||
tmux set-option -gq display-time "$saved_display_time"
|
$TMUX_CMD_PATH set-option -gq display-time "$saved_display_time"
|
||||||
}
|
}
|
||||||
|
|
||||||
# this is used to get "clean" integer version number. Examples:
|
# this is used to get "clean" integer version number. Examples:
|
||||||
|
|
10
tpm
10
tpm
|
@ -4,6 +4,12 @@ CURRENT_DIR="$( cd "$( dirname "${BASH_SOURCE[0]}" )" && pwd )"
|
||||||
BINDINGS_DIR="$CURRENT_DIR/bindings"
|
BINDINGS_DIR="$CURRENT_DIR/bindings"
|
||||||
SCRIPTS_DIR="$CURRENT_DIR/scripts"
|
SCRIPTS_DIR="$CURRENT_DIR/scripts"
|
||||||
|
|
||||||
|
# Try to find the executable path of the currently running
|
||||||
|
# tmux server, fallback to just "tmux" if not found or no
|
||||||
|
# procfs aviliable (non-linux).
|
||||||
|
export TMUX_CMD_PATH=$(realpath "/proc/$(tmux display -p '#{pid}')/exe" 2> /dev/null || echo "tmux" | sed -z '$ s/\n$//')
|
||||||
|
echo "tmux executable used: $TMUX_CMD_PATH"
|
||||||
|
|
||||||
source "$SCRIPTS_DIR/variables.sh"
|
source "$SCRIPTS_DIR/variables.sh"
|
||||||
|
|
||||||
get_tmux_option() {
|
get_tmux_option() {
|
||||||
|
@ -18,7 +24,7 @@ get_tmux_option() {
|
||||||
}
|
}
|
||||||
|
|
||||||
tpm_path_set() {
|
tpm_path_set() {
|
||||||
tmux show-environment -g "$DEFAULT_TPM_ENV_VAR_NAME" >/dev/null 2>&1
|
$TMUX_CMD_PATH show-environment -g "$DEFAULT_TPM_ENV_VAR_NAME" >/dev/null 2>&1
|
||||||
}
|
}
|
||||||
|
|
||||||
# Check if configuration file exists at an XDG-compatible location, if so use
|
# Check if configuration file exists at an XDG-compatible location, if so use
|
||||||
|
@ -31,7 +37,7 @@ set_default_tpm_path() {
|
||||||
tpm_path="$xdg_tmux_path/plugins/"
|
tpm_path="$xdg_tmux_path/plugins/"
|
||||||
fi
|
fi
|
||||||
|
|
||||||
tmux set-environment -g "$DEFAULT_TPM_ENV_VAR_NAME" "$tpm_path"
|
$TMUX_CMD_PATH set-environment -g "$DEFAULT_TPM_ENV_VAR_NAME" "$tpm_path"
|
||||||
}
|
}
|
||||||
|
|
||||||
# Ensures TMUX_PLUGIN_MANAGER_PATH global env variable is set.
|
# Ensures TMUX_PLUGIN_MANAGER_PATH global env variable is set.
|
||||||
|
|
Loading…
Reference in a new issue