Removing the last_resized variable

Instead resizing only if pane_active is set so we are sure the resizep
is called only once
This commit is contained in:
Arno Mayrhofer 2014-10-25 01:19:56 +02:00 committed by Bruno Sutic
parent ad52ade4bf
commit 0b496dd228

View File

@ -100,15 +100,12 @@ save_shell_history() {
dump_panes() { dump_panes() {
local full_command local full_command
local d=$'\t' # delimiter local d=$'\t' # delimiter
local last_resized="none-resized"
dump_panes_raw | dump_panes_raw |
while IFS=$'\t' read line_type session_name window_number window_name window_active window_flags pane_index dir pane_active pane_command pane_pid; do while IFS=$'\t' read line_type session_name window_number window_name window_active window_flags pane_index dir pane_active pane_command pane_pid; do
# check if current pane is part of a maximized window and if we haven't maximized it already # check if current pane is part of a maximized window and if the pane is active
if [[ "${window_flags}" == *Z* ]] && [[ "${last_resized}" != ${window_number} ]]; then if [[ "${window_flags}" == *Z* ]] && [[ ${pane_active} == 1 ]]; then
# unmaximize the pane # unmaximize the pane
tmux resize-pane -Z -t "${session_name}:${window_number}" tmux resize-pane -Z -t "${session_name}:${window_number}"
# set last resized window to current number in order to avoid maximizing again
last_resized=${window_number}
fi fi
full_command="$(pane_full_command $pane_pid)" full_command="$(pane_full_command $pane_pid)"
echo "${line_type}${d}${session_name}${d}${window_number}${d}${window_name}${d}${window_active}${d}${window_flags}${d}${pane_index}${d}${dir}${d}${pane_active}${d}${pane_command}${d}:${full_command}" echo "${line_type}${d}${session_name}${d}${window_number}${d}${window_name}${d}${window_active}${d}${window_flags}${d}${pane_index}${d}${dir}${d}${pane_active}${d}${pane_command}${d}:${full_command}"