I want tmux to show pane statuses only when there is more than one pane in the current window. I have currently devised this which will not work when closing all panes but one in a window (meaning one pane will be left but its status won't get hidden):
# Show pane status only when there is more than one pane
set-hook -g window-linked 'set-option -w pane-border-status off'
set-hook -g window-layout-changed 'if-shell -F "#{!=:#{window_panes}, 1}" "set-option -w pane-border-status top" ; if-shell -F "#{==:#{window_panes}, 1}" "set-option -w pane-border-status off"'
set-hook -g window-pane-changed 'if-shell -F "#{!=:#{window_panes}, 1}" "set-option -w pane-border-status top" ; if-shell -F "#{==:#{window_panes}, 1}" "set-option -w pane-border-status off"'