fixed maximize pane when another session already contains a maximized window, fixes #37
This commit is contained in:
parent
71a2b76681
commit
1bfce57aaa
1 changed files with 8 additions and 7 deletions
15
.tmux.conf
15
.tmux.conf
|
@ -171,17 +171,18 @@ run 'cut -c3- ~/.tmux.conf | sh -s _apply_configuration'
|
||||||
# }
|
# }
|
||||||
#
|
#
|
||||||
# _maximize_pane() {
|
# _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" )
|
# 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
|
# if [ -z "$restore" ]; then
|
||||||
# [ "$(tmux list-panes | wc -l | sed 's/^ *//g')" -eq 1 ] && tmux display "Can't maximize with only one pane" && return
|
# [ "$(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 -P "exec maximized... 2> /dev/null & tmux setw remain-on-exit on; printf 'Pane has been maximized, press <prefix>+ to restore. %s' \\$current_pane")
|
# 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%.*}
|
# 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
|
# 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
|
# sleep 0.01
|
||||||
# guard=$((guard - 1))
|
# guard=$((guard - 1))
|
||||||
|
@ -191,7 +192,7 @@ run 'cut -c3- ~/.tmux.conf | sh -s _apply_configuration'
|
||||||
# fi
|
# fi
|
||||||
#
|
#
|
||||||
# new_pane=$(tmux display -p '#{pane_id}')
|
# 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
|
# else
|
||||||
# $restore || tmux kill-pane
|
# $restore || tmux kill-pane
|
||||||
# fi
|
# fi
|
||||||
|
@ -613,7 +614,7 @@ run 'cut -c3- ~/.tmux.conf | sh -s _apply_configuration'
|
||||||
# fi
|
# 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
|
# 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
|
# else
|
||||||
# tmux bind + display 'your tmux version has a buggy swap-pane command - see ticket #108, fixed in upstream commit 78e783e'
|
# tmux bind + display 'your tmux version has a buggy swap-pane command - see ticket #108, fixed in upstream commit 78e783e'
|
||||||
# fi
|
# fi
|
||||||
|
|
Loading…
Reference in a new issue