restore_pane_process() { | |
local pane_full_command="$1" | |
local session_name="$2" | |
local window_number="$3" | |
local pane_index="$4" | |
local dir="$5" | |
if _process_should_be_restored "$pane_full_command" "$session_name" "$window_number" "$pane_index"; then | |
# These two commands don't seem to be needed if addressing session:window.pane absolutely (see below) | |
tmux switch-client -t "${session_name}:${window_number}" | |
tmux select-pane -t "$pane_index" | |
local inline_strategy="$(_get_inline_strategy "$pane_full_command")" # might not be defined | |
if [ -n "$inline_strategy" ]; then | |
# inline strategy exists | |
# check for additional "expansion" of inline strategy, e.g. `vim` to `vim -S` | |
if _strategy_exists "$inline_strategy"; then | |
local strategy_file="$(_get_strategy_file "$inline_strategy")" | |
local inline_strategy="$($strategy_file "$pane_full_command" "$dir")" | |
fi | |
#tmux send-keys "$inline_strategy" "C-m" | |
# address session:window.pane absolutely | |
tmux send-keys -t "${session_name}:${window_number}.${pane_index}" "$inline_strategy" "C-m" | |
elif _strategy_exists "$pane_full_command"; then | |
local strategy_file="$(_get_strategy_file "$pane_full_command")" | |
local strategy_command="$($strategy_file "$pane_full_command" "$dir")" | |
#tmux send-keys "$strategy_command" "C-m" | |
# address session:window.pane absolutely | |
tmux send-keys -t "${session_name}:${window_number}.${pane_index}" "$strategy_command" "C-m" | |
else | |
# just invoke the command | |
#tmux send-keys "$pane_full_command" "C-m" | |
# address session:window.pane absolutely | |
tmux send-keys -t "${session_name}:${window_number}.${pane_index}" "$pane_full_command" "C-m" | |
fi | |
fi | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment