# libtmux.Pane

- **Module:** libtmux
- **Package:** libtmux
- **Language:** Python
- **Kind:** class
- **Source:** https://github.com/tmux-python/libtmux/blob/036c521c4b83ce6e434eb50afe2a0d08a6a05e46/src/libtmux/pane.py#L50
- **Page:** https://libtmux.org/reference/py/libtmux-pane/

:term:`tmux(1)` :term:`Pane` [pane_manual]_.

``Pane`` instances can send commands directly to a pane, or traverse
between linked tmux objects.

## Example

```python
>>> pane
Pane(%1 Window(@1 1:..., Session($1 ...)))
```

## Example

```python
>>> pane in window.panes
True
```

## Example

```python
>>> pane.window
Window(@1 1:..., Session($1 ...))
```

## Example

```python
>>> pane.session
Session($1 ...)
```

## Example

The pane can be used as a context manager to ensure proper cleanup:

```python
>>> with window.split() as pane:
...     pane.send_keys('echo "Hello"')
...     # Do work with the pane
...     # Pane will be killed automatically when exiting the context
```

## Members

- `default_option_scope` (attribute)
- `default_hook_scope` (attribute)
- `server` (attribute)
- `__enter__` (method) — Enter the context, returning self.
- `__exit__` (method) — Exit the context, killing the pane if it exists.
- `refresh` (method) — Refresh pane attributes from tmux.
- `from_pane_id` (method) — Create Pane from existing pane_id.
- `from_env` (method) — Return the pane this process is running inside of.
- `window` (property) — Parent window of pane.
- `session` (property) — Parent session of pane.
- `cmd` (method) — Execute tmux subcommand within pane context.
- `resize` (method) — Resize tmux pane.
- `capture_pane` (method) — Capture text from pane.
- `send_keys` (method) — ``$ tmux send-keys`` to the pane.
- `display_message` (method) — Display message to pane.
- `kill` (method) — Kill :class:`Pane`.
- `select` (method) — Select pane.
- `select_pane` (method) — Select pane.
- `split` (method) — Split window and return :class:`Pane`, by default beneath current pane.
- `new_pane` (method) — Create a floating :class:`Pane` via ``$ tmux new-pane`` (tmux 3.7+).
- `set_width` (method) — Set pane width.
- `set_height` (method) — Set pane height.
- `set_title` (method) — Set pane title via ``select-pane -T``.
- `enter` (method) — Send carriage return to pane.
- `display_popup` (method) — Display a popup overlay via ``$ tmux display-popup``.
- `paste_buffer` (method) — Paste a buffer into the pane via ``$ tmux paste-buffer``.
- `pipe` (method) — Pipe pane output to a shell command via ``$ tmux pipe-pane``.
- `copy_mode` (method) — Enter copy mode via ``$ tmux copy-mode``.
- `clock_mode` (method) — Enter clock mode via ``$ tmux clock-mode``.
- `display_panes` (method) — Show pane numbers via ``$ tmux display-panes``.
- `choose_buffer` (method) — Enter buffer chooser via ``$ tmux choose-buffer``.
- `choose_client` (method) — Enter client chooser via ``$ tmux choose-client``.
- `choose_tree` (method) — Enter tree chooser via ``$ tmux choose-tree``.
- `customize_mode` (method) — Enter customize mode via ``$ tmux customize-mode``.
- `find_window` (method) — Search for a window matching a string via ``$ tmux find-window``.
- `send_prefix` (method) — Send the prefix key to the pane via ``$ tmux send-prefix``.
- `respawn` (method) — Respawn the pane process via ``$ tmux respawn-pane``.
- `move` (method) — Move this pane to another window via ``$ tmux move-pane``.
- `join` (method) — Join this pane into another window/pane via ``$ tmux join-pane``.
- `break_pane` (method) — Break this pane out into a new window via ``$ tmux break-pane``.
- `swap` (method) — Swap this pane with another via ``$ tmux swap-pane``.
- `clear_history` (method) — Clear pane history buffer via ``$ tmux clear-history``.
- `clear` (method) — Clear pane.
- `reset` (method) — Reset terminal state and clear pane history.
- `__eq__` (method) — Equal operator for :class:`Pane` object.
- `__repr__` (method) — Representation of :class:`Pane` object.
- `id` (property) — Alias of :attr:`Pane.pane_id`.
- `index` (property) — Alias of :attr:`Pane.pane_index`.
- `height` (property) — Alias of :attr:`Pane.pane_height`.
- `width` (property) — Alias of :attr:`Pane.pane_width`.
- `title` (property) — Alias for :attr:`pane_title`.
- `at_top` (property) — Typed, converted wrapper around :attr:`Pane.pane_at_top`.
- `at_bottom` (property) — Typed, converted wrapper around :attr:`Pane.pane_at_bottom`.
- `at_left` (property) — Typed, converted wrapper around :attr:`Pane.pane_at_left`.
- `at_right` (property) — Typed, converted wrapper around :attr:`Pane.pane_at_right`.
- `split_window` (method) — Split window at pane and return newly created :class:`Pane`.
- `get` (method) — Return key-based lookup. Deprecated by attributes.
- `__getitem__` (method) — Return item lookup by key. Deprecated in favor of attributes.
- `resize_pane` (method) — Resize pane, deprecated by :meth:`Pane.resize`.
- `active_window_index` (attribute)
- `alternate_saved_x` (attribute)
- `alternate_saved_y` (attribute)
- `bracket_paste_flag` (attribute)
- `buffer_name` (attribute)
- `buffer_sample` (attribute)
- `buffer_size` (attribute)
- `client_activity` (attribute)
- `client_cell_height` (attribute)
- `client_cell_width` (attribute)
- `client_control_mode` (attribute)
- `client_created` (attribute)
- `client_discarded` (attribute)
- `client_flags` (attribute)
- `client_height` (attribute)
- `client_key_table` (attribute)
- `client_last_session` (attribute)
- `client_mode_format` (attribute)
- `client_name` (attribute)
- `client_pid` (attribute)
- `client_prefix` (attribute)
- `client_readonly` (attribute)
- `client_session` (attribute)
- `client_termfeatures` (attribute)
- `client_termname` (attribute)
- `client_termtype` (attribute)
- `client_tty` (attribute)
- `client_uid` (attribute)
- `client_user` (attribute)
- `client_utf8` (attribute)
- `client_width` (attribute)
- `client_written` (attribute)
- `command_list_alias` (attribute)
- `command_list_name` (attribute)
- `command_list_usage` (attribute)
- `config_files` (attribute)
- `copy_cursor_line` (attribute)
- `copy_cursor_word` (attribute)
- `copy_cursor_x` (attribute)
- `copy_cursor_y` (attribute)
- `current_file` (attribute)
- `cursor_character` (attribute)
- `cursor_flag` (attribute)
- `cursor_x` (attribute)
- `cursor_y` (attribute)
- `history_bytes` (attribute)
- `history_limit` (attribute)
- `history_size` (attribute)
- `insert_flag` (attribute)
- `keypad_cursor_flag` (attribute)
- `keypad_flag` (attribute)
- `last_window_index` (attribute)
- `line` (attribute)
- `mouse_all_flag` (attribute)
- `mouse_any_flag` (attribute)
- `mouse_button_flag` (attribute)
- `mouse_sgr_flag` (attribute)
- `mouse_standard_flag` (attribute)
- `next_session_id` (attribute)
- `origin_flag` (attribute)
- `pane_active` (attribute)
- `pane_at_bottom` (attribute)
- `pane_at_left` (attribute)
- `pane_at_right` (attribute)
- `pane_at_top` (attribute)
- `pane_bg` (attribute)
- `pane_bottom` (attribute)
- `pane_current_command` (attribute)
- `pane_current_path` (attribute)
- `pane_dead` (attribute)
- `pane_dead_signal` (attribute)
- `pane_dead_status` (attribute)
- `pane_dead_time` (attribute)
- `pane_fg` (attribute)
- `pane_flags` (attribute)
- `pane_floating_flag` (attribute)
- `pane_format` (attribute)
- `pane_height` (attribute)
- `pane_id` (attribute)
- `pane_in_mode` (attribute)
- `pane_index` (attribute)
- `pane_input_off` (attribute)
- `pane_last` (attribute)
- `pane_left` (attribute)
- `pane_marked` (attribute)
- `pane_marked_set` (attribute)
- `pane_mode` (attribute)
- `pane_path` (attribute)
- `pane_pb_progress` (attribute)
- `pane_pb_state` (attribute)
- `pane_pid` (attribute)
- `pane_pipe` (attribute)
- `pane_pipe_pid` (attribute)
- `pane_right` (attribute)
- `pane_search_string` (attribute)
- `pane_start_command` (attribute)
- `pane_start_path` (attribute)
- `pane_synchronized` (attribute)
- `pane_tabs` (attribute)
- `pane_title` (attribute)
- `pane_top` (attribute)
- `pane_tty` (attribute)
- `pane_width` (attribute)
- `pane_x` (attribute)
- `pane_y` (attribute)
- `pane_z` (attribute)
- `pane_zoomed_flag` (attribute)
- `pid` (attribute)
- `scroll_position` (attribute)
- `scroll_region_lower` (attribute)
- `scroll_region_upper` (attribute)
- `search_match` (attribute)
- `selection_end_x` (attribute)
- `selection_end_y` (attribute)
- `selection_start_x` (attribute)
- `selection_start_y` (attribute)
- `session_activity` (attribute)
- `session_alerts` (attribute)
- `session_attached` (attribute)
- `session_attached_list` (attribute)
- `session_created` (attribute)
- `session_format` (attribute)
- `session_group` (attribute)
- `session_group_attached` (attribute)
- `session_group_attached_list` (attribute)
- `session_group_list` (attribute)
- `session_group_many_attached` (attribute)
- `session_group_size` (attribute)
- `session_grouped` (attribute)
- `session_id` (attribute)
- `session_last_attached` (attribute)
- `session_many_attached` (attribute)
- `session_marked` (attribute)
- `session_name` (attribute)
- `session_path` (attribute)
- `session_stack` (attribute)
- `session_windows` (attribute)
- `socket_path` (attribute)
- `start_time` (attribute)
- `synchronized_output_flag` (attribute)
- `uid` (attribute)
- `user` (attribute)
- `version` (attribute)
- `window_active` (attribute)
- `window_active_clients` (attribute)
- `window_active_clients_list` (attribute)
- `window_active_sessions` (attribute)
- `window_active_sessions_list` (attribute)
- `window_activity` (attribute)
- `window_activity_flag` (attribute)
- `window_bell_flag` (attribute)
- `window_bigger` (attribute)
- `window_cell_height` (attribute)
- `window_cell_width` (attribute)
- `window_end_flag` (attribute)
- `window_flags` (attribute)
- `window_format` (attribute)
- `window_height` (attribute)
- `window_id` (attribute)
- `window_index` (attribute)
- `window_last_flag` (attribute)
- `window_layout` (attribute)
- `window_linked` (attribute)
- `window_linked_sessions` (attribute)
- `window_linked_sessions_list` (attribute)
- `window_marked_flag` (attribute)
- `window_name` (attribute)
- `window_offset_x` (attribute)
- `window_offset_y` (attribute)
- `window_panes` (attribute)
- `window_raw_flags` (attribute)
- `window_silence_flag` (attribute)
- `window_stack_index` (attribute)
- `window_start_flag` (attribute)
- `window_visible_layout` (attribute)
- `window_width` (attribute)
- `window_zoomed_flag` (attribute)
- `wrap_flag` (attribute)
- `_refresh` (method) — Refresh dataclass fields from a single ``list-*`` row.
- `__init__` (method) — When not a user (custom) option, scope can be implied.
- `set_option` (method) — Set option for tmux target.
- `unset_option` (method) — Unset option for tmux target.
- `_show_options_raw` (method) — Return a dict of options for the target.
- `_show_options_dict` (method) — Return dict of options for the target.
- `_show_options` (method) — Return a dict of options for the target.
- `show_options` (method) — Return all options for the target.
- `_show_option_raw` (method) — Return raw option output for target.
- `_show_option` (method) — Return option value for the target.
- `show_option` (method) — Return option value for the target.
- `hooks` (attribute)
- `_tmux_bin` (property) — Resolve tmux_bin from self (Server) or self.server (Session/Window/Pane).
- `run_hook` (method) — Run a hook immediately. Useful for testing.
- `set_hook` (method) — Set hook for tmux target.
- `unset_hook` (method) — Unset hook for tmux target.
- `show_hooks` (method) — Return a dict of hooks for the target.
- `_show_hook` (method) — Return value for the hook.
- `show_hook` (method) — Return value for a hook.
- `set_hooks` (method) — Set multiple indexed hooks at once.
