Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

optimize xpns_organize_panes #185

Merged
merged 12 commits into from
Apr 6, 2023
16 changes: 7 additions & 9 deletions bin/xpanes
Original file line number Diff line number Diff line change
Expand Up @@ -775,20 +775,18 @@ xpns_organize_panes() {
local _window_name="$1"
shift
local _args_num="$1"
## ----------------

# Default behavior
## ----------------
if [[ "${_args_num}" -eq 1 ]]; then
${TMUX_XPANES_EXEC} select-layout -t "${_window_name}" even-horizontal
elif [[ "${_args_num}" -gt 1 ]]; then
${TMUX_XPANES_EXEC} select-layout -t "${_window_name}" tiled
local layout_command=" select-layout -t ${_window_name} even-horizontal"
if ((_args_num > 1)); then
layout_command=" select-layout -t ${_window_name} tiled"
fi
## ----------------
# Update layout
## ----------------
if [[ "${XP_LAYOUT}" != "${XP_DEFAULT_LAYOUT}" ]]; then
${TMUX_XPANES_EXEC} select-layout -t "${_window_name}" "${XP_LAYOUT}"
layout_command=" select-layout -t ${_window_name} ${XP_LAYOUT}"
fi
# shellcheck disable=SC2086
${TMUX_XPANES_EXEC} $layout_command
}

#
Expand Down