1
0
Fork 0
mirror of synced 2024-12-21 22:31:06 -05:00

fixed maximize pane when another session already contains a maximized window, fixes #37

This commit is contained in:
Gregory Pakosz 2016-11-07 22:34:31 +01:00
parent 71a2b76681
commit 1bfce57aaa

View file

@ -171,17 +171,18 @@ run 'cut -c3- ~/.tmux.conf | sh -s _apply_configuration'
# }
#
# _maximize_pane() {
# current_pane=$(tmux display -p '#{pane_id}')
# current_session=${1:-$(tmux display -p '#{session_name}')}
# current_pane=${2:-$(tmux display -p '#{pane_id}')}
#
# dead_panes=$(tmux list-panes -s -F '#{pane_dead} #{pane_id} #{pane_start_command}' | grep -o '^1 %.\+maximized.\+$' || true)
# dead_panes=$(tmux list-panes -s -t "$current_session" -F '#{pane_dead} #{pane_id} #{pane_start_command}' | grep -o '^1 %.\+maximized.\+$' || true)
# restore=$(echo "$dead_panes" | sed -n -E -e "s/^1 $current_pane .+maximized.+(%[0-9]+)$/tmux swap-pane -s \1 -t $current_pane \; kill-pane -t $current_pane/p" -e "s/^1 (%[0-9]+) .+maximized.+$current_pane$/tmux swap-pane -s \1 -t $current_pane \; kill-pane -t \1/p" )
#
# if [ -z "$restore" ]; then
# [ "$(tmux list-panes | wc -l | sed 's/^ *//g')" -eq 1 ] && tmux display "Can't maximize with only one pane" && return
# window=$(tmux new-window -P "exec maximized... 2> /dev/null & tmux setw remain-on-exit on; printf 'Pane has been maximized, press <prefix>+ to restore. %s' \\$current_pane")
# [ "$(tmux list-panes -t "$current_session:" | wc -l | sed 's/^ *//g')" -eq 1 ] && tmux display "Can't maximize with only one pane" && return
# window=$(tmux new-window -t "$current_session:" -P "exec maximized... 2> /dev/null & tmux setw -t $current_session remain-on-exit on; printf 'Pane has been maximized, press <prefix>+ to restore. %s' \\$current_pane")
# window=${window%.*}
#
# guard=50
# guard=10
# while [ x"$(tmux list-panes -t "$window" -F '#{session_name}:#{window_index} #{pane_dead}' 2>/dev/null)" != x"$window 1" ] && [ "$guard" -ne 0 ]; do
# sleep 0.01
# guard=$((guard - 1))
@ -191,7 +192,7 @@ run 'cut -c3- ~/.tmux.conf | sh -s _apply_configuration'
# fi
#
# new_pane=$(tmux display -p '#{pane_id}')
# tmux setw remain-on-exit off \; swap-pane -s "$current_pane" -t "$new_pane"
# tmux setw -t "$window" remain-on-exit off \; swap-pane -s "$current_pane" -t "$new_pane"
# else
# $restore || tmux kill-pane
# fi
@ -613,7 +614,7 @@ run 'cut -c3- ~/.tmux.conf | sh -s _apply_configuration'
# fi
#
# if tmux -q -L swap-pane-test -f /dev/null new-session -d \; new-window \; new-window \; swap-pane -t :1 \; kill-session; then
# tmux bind + run 'cut -c3- ~/.tmux.conf | sh -s _maximize_pane'
# tmux bind + run 'cut -c3- ~/.tmux.conf | sh -s _maximize_pane #{session_name} #D'
# else
# tmux bind + display 'your tmux version has a buggy swap-pane command - see ticket #108, fixed in upstream commit 78e783e'
# fi