From cedd1292c1b0e5b76f52475cbfb50df1d8155cbb Mon Sep 17 00:00:00 2001 From: Bruno Sutic Date: Fri, 29 Aug 2014 17:04:00 +0200 Subject: [PATCH] Restore window zoom state Close #25 --- CHANGELOG.md | 1 + README.md | 1 + scripts/session_restorer.sh | 10 +++++++++- 3 files changed, 11 insertions(+), 1 deletion(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index e416a44..379756f 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -8,6 +8,7 @@ - if pane exists from before session restore - do not restore the process within it. This makes the restoration process even more idempotent. - more panes within a window can now be restored +- restore window zoom state ### v0.2.0, 2014-08-29 - bugfix: with vim 'session' strategy, if the session file does not exist - make diff --git a/README.md b/README.md index 0746794..b015939 100644 --- a/README.md +++ b/README.md @@ -28,6 +28,7 @@ This plugin goes to great lengths to save and restore all the details from your - **exact pane layouts** within windows - active and alternative session - active and alternative window for each session +- windows with focus - active pane for each window - programs running within a pane! More details in the [configuration section](#configuration). diff --git a/scripts/session_restorer.sh b/scripts/session_restorer.sh index 4336e1a..6f75e68 100755 --- a/scripts/session_restorer.sh +++ b/scripts/session_restorer.sh @@ -160,13 +160,20 @@ restore_pane_layout_for_each_window() { } restore_active_pane_for_each_window() { - awk 'BEGIN { FS="\t"; OFS="\t" } /^pane/ && $7 != 0 && $9 == 1 { print $2, $3, $7; }' $(last_session_path) | + awk 'BEGIN { FS="\t"; OFS="\t" } /^pane/ && $9 == 1 { print $2, $3, $7; }' $(last_session_path) | while IFS=$'\t' read session_name window_number active_pane; do tmux switch-client -t "${session_name}:${window_number}" tmux select-pane -t "$active_pane" done } +restore_zoomed_windows() { + awk 'BEGIN { FS="\t"; OFS="\t" } /^window/ && $5 ~ /Z/ { print $2, $3; }' $(last_session_path) | + while IFS=$'\t' read session_name window_number; do + tmux resize-pane -t "${session_name}:${window_number}" -Z + done +} + restore_active_and_alternate_windows() { awk 'BEGIN { FS="\t"; OFS="\t" } /^window/ && $5 ~ /[*-]/ { print $2, $4, $3; }' $(last_session_path) | sort -u | @@ -191,6 +198,7 @@ main() { restore_all_pane_processes # below functions restore exact cursor positions restore_active_pane_for_each_window + restore_zoomed_windows restore_active_and_alternate_windows restore_active_and_alternate_sessions stop_spinner