Skip to content

Commit

Permalink
Merge pull request #185 from ReDTerraN/optimizeorgpanes
Browse files Browse the repository at this point in the history
optimize xpns_organize_panes
  • Loading branch information
greymd authored Apr 6, 2023
2 parents 82df835 + d1847b6 commit 92d9709
Showing 1 changed file with 7 additions and 9 deletions.
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

0 comments on commit 92d9709

Please sign in to comment.