@@ -162,20 +162,23 @@ new_pane() {
162
162
local window_number=" $2 "
163
163
local dir=" $3 "
164
164
local pane_index=" $4 "
165
+ local pane_title=" $5 "
165
166
local pane_id=" ${session_name} :${window_number} .${pane_index} "
166
167
if is_restoring_pane_contents && pane_contents_file_exists " $pane_id " ; then
167
168
local pane_creation_command=" $( pane_creation_command " $session_name " " $window_number " " $pane_index " ) "
168
169
tmux split-window -t " ${session_name} :${window_number} " -c " $dir " " $pane_creation_command "
169
170
else
170
171
tmux split-window -t " ${session_name} :${window_number} " -c " $dir "
171
172
fi
173
+ # set pane title
174
+ tmux select-pane -t " ${session_name} :${window_number} .${pane_index} " -T " ${pane_title} "
172
175
# minimize window so more panes can fit
173
- tmux resize-pane -t " ${session_name} :${window_number} " -U " 999"
176
+ tmux resize-pane -t " ${session_name} :${window_number} " -U " 999"
174
177
}
175
178
176
179
restore_pane () {
177
180
local pane=" $1 "
178
- while IFS=$d read line_type session_name window_number window_active window_flags pane_index dir pane_active pane_command pane_full_command; do
181
+ while IFS=$d read line_type session_name window_number window_active window_flags pane_index pane_title dir pane_active pane_command pane_full_command; do
179
182
dir=" $( remove_first_char " $dir " ) "
180
183
pane_full_command=" $( remove_first_char " $pane_full_command " ) "
181
184
if [ " $session_name " == " 0" ]; then
@@ -186,15 +189,15 @@ restore_pane() {
186
189
# overwrite the pane
187
190
# happens only for the first pane if it's the only registered pane for the whole tmux server
188
191
local pane_id=" $( tmux display-message -p -F " #{pane_id}" -t " $session_name :$window_number " ) "
189
- new_pane " $session_name " " $window_number " " $dir " " $pane_index "
192
+ new_pane " $session_name " " $window_number " " $dir " " $pane_index " " $pane_title "
190
193
tmux kill-pane -t " $pane_id "
191
194
else
192
195
# Pane exists, no need to create it!
193
196
# Pane existence is registered. Later, its process also won't be restored.
194
197
register_existing_pane " $session_name " " $window_number " " $pane_index "
195
198
fi
196
199
elif window_exists " $session_name " " $window_number " ; then
197
- new_pane " $session_name " " $window_number " " $dir " " $pane_index "
200
+ new_pane " $session_name " " $window_number " " $dir " " $pane_index " " $pane_title "
198
201
elif session_exists " $session_name " ; then
199
202
new_window " $session_name " " $window_number " " $dir " " $pane_index "
200
203
else
@@ -302,7 +305,7 @@ restore_window_properties() {
302
305
}
303
306
304
307
restore_shell_history () {
305
- awk ' BEGIN { FS="\t"; OFS="\t" } /^pane/ { print $2, $3, $6, $9 ; }' $( last_resurrect_file) |
308
+ awk ' BEGIN { FS="\t"; OFS="\t" } /^pane/ { print $2, $3, $6, $10 ; }' $( last_resurrect_file) |
306
309
while IFS=$d read session_name window_number pane_index pane_command; do
307
310
if ! is_pane_registered_as_existing " $session_name " " $window_number " " $pane_index " ; then
308
311
local pane_id=" $session_name :$window_number .$pane_index "
@@ -323,7 +326,7 @@ restore_shell_history() {
323
326
restore_all_pane_processes () {
324
327
if restore_pane_processes_enabled; then
325
328
local pane_full_command
326
- awk ' BEGIN { FS="\t"; OFS="\t" } /^pane/ && $10 !~ "^:$" { print $2, $3, $6, $7 , $10 ; }' $( last_resurrect_file) |
329
+ awk ' BEGIN { FS="\t"; OFS="\t" } /^pane/ && $11 !~ "^:$" { print $2, $3, $6, $8 , $11 ; }' $( last_resurrect_file) |
327
330
while IFS=$d read -r session_name window_number pane_index dir pane_full_command; do
328
331
dir=" $( remove_first_char " $dir " ) "
329
332
pane_full_command=" $( remove_first_char " $pane_full_command " ) "
@@ -333,15 +336,15 @@ restore_all_pane_processes() {
333
336
}
334
337
335
338
restore_active_pane_for_each_window () {
336
- awk ' BEGIN { FS="\t"; OFS="\t" } /^pane/ && $8 == 1 { print $2, $3, $6; }' $( last_resurrect_file) |
339
+ awk ' BEGIN { FS="\t"; OFS="\t" } /^pane/ && $9 == 1 { print $2, $3, $6; }' $( last_resurrect_file) |
337
340
while IFS=$d read session_name window_number active_pane; do
338
341
tmux switch-client -t " ${session_name} :${window_number} "
339
342
tmux select-pane -t " $active_pane "
340
343
done
341
344
}
342
345
343
346
restore_zoomed_windows () {
344
- awk ' BEGIN { FS="\t"; OFS="\t" } /^pane/ && $5 ~ /Z/ && $8 == 1 { print $2, $3; }' $( last_resurrect_file) |
347
+ awk ' BEGIN { FS="\t"; OFS="\t" } /^pane/ && $5 ~ /Z/ && $9 == 1 { print $2, $3; }' $( last_resurrect_file) |
345
348
while IFS=$d read session_name window_number; do
346
349
tmux resize-pane -t " ${session_name} :${window_number} " -Z
347
350
done
0 commit comments