# libtmux.Pane.new_pane

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

```
libtmux.Pane.new_pane(self, target: int | str | None = None, start_directory: StrPath | None = None, attach: bool = False, shell: str | None = None, environment: dict[str, str] | None = None, width: int | None = None, height: int | None = None, x: int | None = None, y: int | None = None, zoom: bool | None = None, empty: bool | None = None, style: str | None = None, active_border_style: str | None = None, inactive_border_style: str | None = None, message: str | None = None, keep: bool | None = None) -> Pane
```

Create a floating :class:`Pane` via ``$ tmux new-pane`` (tmux 3.7+).

Use :meth:`split` for a tiled pane. Floating panes sit above the tiled
layout like a popup, but unlike a popup they are not modal and behave
like normal panes. The returned pane has ``pane_floating_flag == "1"``.

## Parameters

- `self`
- `target` (int | str | None) — Custom *target-pane*, used by :meth:`Window.new_pane`.
- `start_directory` (StrPath | None) — Working directory for the new pane (``-c`` flag).
- `attach` (bool) — Make the new pane the active pane, default False (``-d`` when
not attaching).
- `shell` (str | None) — Command to run in the pane. The pane closes when it exits.
- `environment` (dict[str, str] | None) — Environment variables for the new pane (``-e`` flag).
- `width` (int | None) — Width of the floating pane in cells (``-x`` flag).
- `height` (int | None) — Height of the floating pane in cells (``-y`` flag).
- `x` (int | None) — X position of the floating pane in cells (``-X`` flag).
- `y` (int | None) — Y position of the floating pane in cells (``-Y`` flag).
- `zoom` (bool | None) — Zoom the pane (``-Z`` flag).
- `empty` (bool | None) — Create an empty pane with no command (``-E`` flag).
- `style` (str | None) — Style for the floating pane (``-s`` flag).
- `active_border_style` (str | None) — Border style when the pane is active (``-S`` flag).
- `inactive_border_style` (str | None) — Border style when the pane is inactive (``-R`` flag).
- `message` (str | None) — Keep the pane open (until a key is pressed) after the command
exits, showing this ``remain-on-exit-format`` message (``-m`` flag).
- `keep` (bool | None) — Keep the pane open until a key is pressed after the command exits
(``-k`` flag), using the default ``remain-on-exit-format``.

## Returns

:class:`Pane`
    The newly created floating pane.

## Raises

- `libtmux.exc.LibTmuxException` — If the tmux server is older than 3.7 (``new-pane`` is unavailable).

## Example

```python
>>> from libtmux.common import has_gte_version
>>> if has_gte_version("3.7"):
...     floating = pane.new_pane(width=40, height=10, shell="sleep 5")
...     is_floating = floating.pane_floating_flag
... else:
...     is_floating = "1"
>>> is_floating
'1'
```
