mirror of
https://github.com/tmux-plugins/tmux-resurrect.git
synced 2024-11-22 04:18:48 +00:00
Maintain the value of automatic-rename
When the session is restored, the windows are renamed to their original names switching off automatic-rename, which can be undesirable. Therefore the value of automatic-rename is now saved for each window and restored after the renaming. If the value is set, that value is saved and then applied. Otherwise, a placeholder of ':' is placed instead, in which case the local option is unset for that window (as it originally was).
This commit is contained in:
parent
716b958145
commit
80adb917c1
@ -292,10 +292,15 @@ handle_session_0() {
|
|||||||
fi
|
fi
|
||||||
}
|
}
|
||||||
|
|
||||||
restore_pane_layout_for_each_window() {
|
restore_pane_layout_and_autonaming_for_each_window() {
|
||||||
\grep '^window' $(last_resurrect_file) |
|
\grep '^window' $(last_resurrect_file) |
|
||||||
while IFS=$d read line_type session_name window_number window_active window_flags window_layout; do
|
while IFS=$d read line_type session_name window_number window_active window_flags window_layout automatic_rename; do
|
||||||
tmux select-layout -t "${session_name}:${window_number}" "$window_layout"
|
tmux select-layout -t "${session_name}:${window_number}" "$window_layout"
|
||||||
|
if [ "${automatic_rename}" = ":" ]; then
|
||||||
|
tmux set-option -u -t "${session_name}:${window_number}" automatic-rename
|
||||||
|
else
|
||||||
|
tmux set-option -t "${session_name}:${window_number}" automatic-rename "$automatic_rename"
|
||||||
|
fi
|
||||||
done
|
done
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -376,7 +381,7 @@ main() {
|
|||||||
execute_hook "pre-restore-all"
|
execute_hook "pre-restore-all"
|
||||||
restore_all_panes
|
restore_all_panes
|
||||||
handle_session_0
|
handle_session_0
|
||||||
restore_pane_layout_for_each_window >/dev/null 2>&1
|
restore_pane_layout_and_autonaming_for_each_window >/dev/null 2>&1
|
||||||
execute_hook "pre-restore-history"
|
execute_hook "pre-restore-history"
|
||||||
if save_shell_history_option_on; then
|
if save_shell_history_option_on; then
|
||||||
restore_shell_history
|
restore_shell_history
|
||||||
|
@ -245,7 +245,10 @@ dump_windows() {
|
|||||||
if is_session_grouped "$session_name"; then
|
if is_session_grouped "$session_name"; then
|
||||||
continue
|
continue
|
||||||
fi
|
fi
|
||||||
echo "${line_type}${d}${session_name}${d}${window_index}${d}${window_active}${d}${window_flags}${d}${window_layout}"
|
automatic_rename="$(tmux show-window-options -vt "${session_name}:${window_index}" automatic-rename)"
|
||||||
|
# If the option was unset, place the ":" placeholder instead.
|
||||||
|
[ -z "${automatic_rename}" ] && automatic_rename=":"
|
||||||
|
echo "${line_type}${d}${session_name}${d}${window_index}${d}${window_active}${d}${window_flags}${d}${window_layout}${d}${automatic_rename}"
|
||||||
done
|
done
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user