mirror of
https://github.com/tmux-plugins/tmux-resurrect.git
synced 2024-11-22 04:18:48 +00:00
Restore active and alternate windows only if they are present in the 'last' file
This commit is contained in:
parent
1c8efb034a
commit
b502572a07
@ -6,6 +6,7 @@
|
||||
- save and restore grouped sessions (used with multi-monitor workflow)
|
||||
- save and restore active and alternate windows in grouped sessions
|
||||
- if there are no grouped sessions, do not output empty line to "last" file
|
||||
- restore active and alternate windows only if they are present in the "last" file
|
||||
|
||||
### v1.5.0, 2014-11-09
|
||||
- add support for restoring neovim sessions
|
||||
|
@ -195,8 +195,14 @@ restore_active_and_alternate_windows_for_grouped_sessions() {
|
||||
local grouped_session="$1"
|
||||
echo "$grouped_session" |
|
||||
while IFS=$'\t' read line_type grouped_session original_session alternate_window_index active_window_index; do
|
||||
tmux switch-client -t "${grouped_session}:${alternate_window_index}"
|
||||
tmux switch-client -t "${grouped_session}:${active_window_index}"
|
||||
alternate_window_index="$(remove_first_char "$alternate_window_index")"
|
||||
active_window_index="$(remove_first_char "$active_window_index")"
|
||||
if [ -n "$alternate_window_index" ]; then
|
||||
tmux switch-client -t "${grouped_session}:${alternate_window_index}"
|
||||
fi
|
||||
if [ -n "$active_window_index" ]; then
|
||||
tmux switch-client -t "${grouped_session}:${active_window_index}"
|
||||
fi
|
||||
done
|
||||
}
|
||||
|
||||
|
@ -142,7 +142,7 @@ dump_grouped_sessions() {
|
||||
# this session "points" to the original session
|
||||
active_window_index="$(get_active_window_index "$session_name")"
|
||||
alternate_window_index="$(get_alternate_window_index "$session_name")"
|
||||
echo "grouped_session${d}${session_name}${d}${original_session}${d}${alternate_window_index}${d}${active_window_index}"
|
||||
echo "grouped_session${d}${session_name}${d}${original_session}${d}:${alternate_window_index}${d}:${active_window_index}"
|
||||
fi
|
||||
done
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user