From 3513855f09aff4c713447e66738944036fb24bc3 Mon Sep 17 00:00:00 2001 From: scmanjarrez Date: Fri, 25 Feb 2022 11:54:36 +0100 Subject: [PATCH] Fixed restoring of alternate and active window for unnamed sessions --- scripts/restore.sh | 9 ++++----- 1 file changed, 4 insertions(+), 5 deletions(-) diff --git a/scripts/restore.sh b/scripts/restore.sh index af7a431..d0363f0 100755 --- a/scripts/restore.sh +++ b/scripts/restore.sh @@ -357,11 +357,10 @@ restore_grouped_sessions() { } restore_active_and_alternate_windows() { - awk 'BEGIN { FS="\t"; OFS="\t" } /^window/ && $6 ~ /[*-]/ { print $2, $4, $3; }' $(last_resurrect_file) | - sort -u | - while IFS=$d read session_name active_window window_number; do - tmux switch-client -t "${session_name}:${window_number}" - done + local active=$(awk 'BEGIN { FS="\t"; OFS="\t" } /^window/ && $6 ~ /\*/ { print $2":"$3; }' $(last_resurrect_file)) + local alternate=$(awk 'BEGIN { FS="\t"; OFS="\t" } /^window/ && $6 ~ /-/ { print $2":"$3; }' $(last_resurrect_file)) + tmux switch-client -t "$alternate" + tmux switch-client -t "$active" } restore_active_and_alternate_sessions() {