Panes#
Contain pseudoterminals (pty(4))
Exist inside Windows
Identified by
%
, e.g.%313
- class libtmux.Pane(server, active_window_index=None, alternate_saved_x=None, alternate_saved_y=None, buffer_name=None, buffer_sample=None, buffer_size=None, client_cell_height=None, client_cell_width=None, client_discarded=None, client_flags=None, client_height=None, client_key_table=None, client_name=None, client_pid=None, client_termname=None, client_tty=None, client_uid=None, client_user=None, client_width=None, client_written=None, command_list_alias=None, command_list_name=None, command_list_usage=None, config_files=None, copy_cursor_line=None, copy_cursor_word=None, copy_cursor_x=None, copy_cursor_y=None, current_file=None, cursor_character=None, cursor_flag=None, cursor_x=None, cursor_y=None, history_bytes=None, history_limit=None, history_size=None, insert_flag=None, keypad_cursor_flag=None, keypad_flag=None, last_window_index=None, line=None, mouse_all_flag=None, mouse_any_flag=None, mouse_button_flag=None, mouse_sgr_flag=None, mouse_standard_flag=None, next_session_id=None, origin_flag=None, pane_active=None, pane_bg=None, pane_bottom=None, pane_current_command=None, pane_current_path=None, pane_dead_signal=None, pane_dead_status=None, pane_dead_time=None, pane_fg=None, pane_height=None, pane_id=None, pane_index=None, pane_left=None, pane_pid=None, pane_right=None, pane_search_string=None, pane_start_command=None, pane_start_path=None, pane_tabs=None, pane_top=None, pane_tty=None, pane_width=None, pid=None, scroll_position=None, scroll_region_lower=None, scroll_region_upper=None, search_match=None, selection_end_x=None, selection_end_y=None, selection_start_x=None, selection_start_y=None, session_activity=None, session_alerts=None, session_attached=None, session_attached_list=None, session_created=None, session_group=None, session_group_attached=None, session_group_list=None, session_group_size=None, session_id=None, session_last_attached=None, session_name=None, session_path=None, session_stack=None, session_windows=None, socket_path=None, start_time=None, uid=None, user=None, version=None, window_active=None, window_active_clients=None, window_active_sessions=None, window_activity=None, window_cell_height=None, window_cell_width=None, window_height=None, window_id=None, window_index=None, window_layout=None, window_linked=None, window_linked_sessions=None, window_linked_sessions_list=None, window_marked_flag=None, window_name=None, window_offset_x=None, window_offset_y=None, window_panes=None, window_raw_flags=None, window_stack_index=None, window_width=None, wrap_flag=None)[source]#
Bases:
Obj
Pane
instances can send commands directly to a pane, or traverse between linked tmux objects.Examples
>>> pane Pane(%1 Window(@1 1:..., Session($1 ...)))
>>> pane in window.panes True
>>> pane.window Window(@1 1:..., Session($1 ...))
>>> pane.session Session($1 ...)
Notes
Changed in version 0.8: Renamed from
.tmux
to.cmd
.References
[pane_manual]- tmux pane. openbsd manpage for TMUX(1).
βEach window displayed by tmux may be split into one or more panes; each pane takes up a certain area of the display and is a separate terminal.β
https://man.openbsd.org/tmux.1#WINDOWS_AND_PANES. Accessed April 1st, 2018.
- cmd(cmd, *args, **kwargs)[source]#
Return
Server.cmd()
defaulting totarget_pane
as target.Send command to tmux with
pane_id
astarget-pane
.Specifying
('-t', 'custom-target')
or('-tcustom_target')
inargs
will override using the objectβspane_id
as target.- Return type:
- resize_pane(*args, **kwargs)[source]#
$ tmux resize-pane
of pane and returnself
.- Return type:
- Parameters:
- Raises:
- capture_pane(start=None, end=None)[source]#
Capture text from pane.
$ tmux capture-pane
to pane.$ tmux capture-pane -S -10
to pane. :rtype:Union
[str
,List
[str
]]``$ tmux capture-pane`-E 3` to pane. ``$ tmux capture-pane`-S - -E -` to pane.
- Parameters:
start ([str,int]) β Specify the starting line number. Zero is the first line of the visible pane. Positive numbers are lines in the visible pane. Negative numbers are lines in the history. β-β is the start of the history. Default: None
end ([str,int]) β Specify the ending line number. Zero is the first line of the visible pane. Positive numbers are lines in the visible pane. Negative numbers are lines in the history. β-β is the end of the visible pane Default: None
- send_keys(cmd, enter=True, suppress_history=False, literal=False)[source]#
$ tmux send-keys
to the pane.A leading space character is added to cmd to avoid polluting the userβs history.
- Return type:
- Parameters:
cmd (str) β Text or input into pane
enter (bool, optional) β Send enter after sending the input, default True.
suppress_history (bool, optional) β
Prepend a space to command to suppress shell history, default False.
Changed in version 0.14: Default changed from True to False.
literal (bool, optional) β Send keys literally, default True.
Examples
>>> pane = window.split_window(shell='sh') >>> pane.capture_pane() ['$']
>>> pane.send_keys('echo "Hello world"', enter=True)
>>> pane.capture_pane() ['$ echo "Hello world"', 'Hello world', '$']
>>> print('\n'.join(pane.capture_pane())) $ echo "Hello world" Hello world $
- display_message(cmd, get_text=False)[source]#
$ tmux display-message
to the pane.Displays a message in target-client status line.
- select_pane()[source]#
Select pane. Return
self
.To select a window object asynchrously. If a
pane
object exists and is no longer longer the current window,w.select_pane()
will makep
the current pane.- Return type:
- split_window(attach=False, vertical=True, start_directory=None, percent=None)[source]#
Split window at pane and return newly created
Pane
.- Return type:
- Parameters:
- enter()[source]#
Send carriage return to pane.
$ tmux send-keys
send Enter to the pane.- Return type:
- property index: Optional[str]#
Alias of
Pane.pane_index
>>> pane.index '0'
>>> pane.index == pane.pane_index True
- property height: Optional[str]#
Alias of
Pane.pane_height
>>> pane.height.isdigit() True
>>> pane.height == pane.pane_height True