Skip to content

Hi could be considered to add an option to hide/unhide a pane or window? #3047

@Ergus

Description

@Ergus

This is actually a feature request,

Could we consider to add an option to hide/unhide a pane like the resize-pane -Z but inverse? The idea is to be hable to open a temporal panel and keep the history information. (Useful for example when working with an editor and want to compile or debug the current code temporarily, and go back and forth)

  • I tried something like resize-pane -t 2:0.1 -y 0 but it keeps one line of the target pane, so it not really hiden.

  • Then I have a bash script like this:

_split() {
	local wid=$(tmux display-message -p '#{window_id}')
	local toggledid="$(tmux show-options -wv @toggleid)"
	local stack=":1000"

	#  var is set         session exists
	if [[ ! -z "${toggledid}" ]] && $(tmux has-session -t $toggledid); then

		local toggledwid=$(tmux display-message -p -t ${toggledid} '#{window_id}')

		if [[ "${toggledwid}" == "${wid}" ]]; then
			# Panel exists and is visible.. so hide it
			if $(tmux has-session -t "${stack}"); then
				# The window stack already exists, so append
				tmux join-pane -dv -s "${toggledid}" -t "${stack}.bottom"
			else
				# The window 100 does not exists, so break (to create)
				tmux break-pane -d -n "stack" -s "${toggledid}" -t "${stack}" \;\
					 set -w -t "${stack}" window-status-current-format '#[bg=red,fg=colour15,bold] #W ' \;\
				     set -w -t "${stack}" window-style bg=blue \;\
					 set -w -t "${stack}" window-active-style bg=blue \;\
					 set -w -t "${stack}" pane-border-status top
			fi
		else
			# The pane exists in other window so, get it back
			tmux join-pane -v -l 10 -s "${toggledid}" -t ".bottom"
		fi
	else
		# The pane does not exist, so create one and it gets active
		tmux split-window -v -c '#{pane_current_path}' -l 10 -t ".bottom" \;\
		     set -wF -q @toggleid '#{pane_id}'
	fi
}

That goes around the limitation a bit, but it is very limited and sometimes conflicts with next-window or swap-window.

So far I see several possible solutions here:

  1. Allow negative values for windows, meaning that any value below base-index is considered like disabled but still local to this section. This may work but has a side effect of keeping session fully hidden, so maybe requires extra modifications...
  2. Really hide the pane somehow
    (looking at the code it may be something like what zoom-window does but calling:
wp1->saved_layout_cell = wp1->layout_cell;
wp1->layout_cell = NULL;

But applied for a single pane.
3. Allow zero sizes in the resize-pane command so the panel will be here but not visible.
4. Implement a sort of toggle pane inherent to every window that can be hidden like the status-bar.

Does it makes sence?
Best,
Ergus

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions