Panes#

class libtmux.Pane(window=None, **kwargs)[source]#

Bases: libtmux.common.TmuxMappingObject, libtmux.common.TmuxRelationalObject

A tmux(1) Pane [pane_manual].

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

Parameters:

window (Window) –

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.

__marker#
property _info(self)#
capture_pane(self)[source]#

Capture text from pane.

$ tmux capture-pane to pane.

Return type:

list

clear(self)[source]#

Clear pane.

cmd(self, cmd, *args, **kwargs)[source]#

Return Server.cmd() defaulting to target_pane as target.

Send command to tmux with pane_id as target-pane.

Specifying ('-t', 'custom-target') or ('-tcustom_target') in args will override using the object’s pane_id as target.

Return type:

Server.cmd

display_message(self, cmd, get_text=False)[source]#

$ tmux display-message to the pane.

Displays a message in target-client status line.

Parameters:
  • cmd (str) – Special parameters to request from pane.

  • get_text (bool, optional) – Returns only text without displaying a message in target-client status line.

Returns:

enter(self)[source]#

Send carriage return to pane.

$ tmux send-keys send Enter to the pane.

find_where(self, attrs)[source]#

Return object on first match.

Changed in version 0.4: Renamed from .findWhere to .find_where.

formatter_prefix = pane_#
get(k[, d]) D[k] if k in D, else d.  d defaults to None.[source]#

D.get(k[,d]) -> D[k] if k in D, else d. d defaults to None.

get_by_id(self, id)[source]#

Return object based on child_id_attribute.

Parameters:

val (str) –

Return type:

object

Notes

Based on `.get()`_ from `backbone.js`_.

items() a set-like object providing a view on D's items[source]#

D.items() -> a set-like object providing a view on D’s items

keys(self)[source]#

Return list of keys.

pop(k[, d]) v, remove specified key and return the corresponding value.[source]#

D.pop(k[,d]) -> v, remove specified key and return the corresponding value. If key is not found, d is returned if given, otherwise KeyError is raised.

popitem() (k, v), remove and return some (key, value) pair[source]#

D.popitem() -> (k, v), remove and return some (key, value) pair as a 2-tuple; but raise KeyError if D is empty.

reset(self)[source]#

Reset and clear pane history.

resize_pane(self, *args, **kwargs)[source]#

$ tmux resize-pane of pane and return self.

Parameters:
  • target_pane (str) – target_pane, or -U,``-D``, -L, -R.

  • height (int) – resize-pane -y dimensions

  • width (int) – resize-pane -x dimensions

Return type:

Pane

Raises:

exc.LibTmuxException

select_pane(self)[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 make p the current pane.

Return type:

pane

send_keys(self, cmd, enter=True, suppress_history=True, literal=False)[source]#

$ tmux send-keys to the pane.

A leading space character is added to cmd to avoid polluting the user’s history.

Parameters:
  • cmd (str) – Text or input into pane

  • enter (bool, optional) – Send enter after sending the input, default True.

  • suppress_history (bool, optional) – Don’t add these keys to the shell history, default True.

  • literal (bool, optional) – Send keys literally, default True.

set_height(self, height)[source]#

Set height of pane.

Parameters:

height (int) – height of pain, in cells

set_width(self, width)[source]#

Set width of pane.

Parameters:

width (int) – pane width, in cells

setdefault(k[, d]) D.get(k,d), also set D[k]=d if k not in D[source]#

D.setdefault(k[,d]) -> D.get(k,d), also set D[k]=d if k not in D

split_window(self, attach=False, vertical=True, start_directory=None, percent=None)[source]#

Split window at pane and return newly created Pane.

Parameters:
  • attach (bool, optional) – Attach / select pane after creation.

  • vertical (bool, optional) – split vertically

  • start_directory (str, optional) – specifies the working directory in which the new pane is created.

  • percent (int, optional) – percentage to occupy with respect to current pane

Return type:

Pane

update([E, ]**F) None.  Update D from mapping/iterable E and F.[source]#

D.update([E, ]**F) -> None. Update D from mapping/iterable E and F. If E present and has a .keys() method, does: for k in E: D[k] = E[k] If E present and lacks .keys() method, does: for (k, v) in E: D[k] = v In either case, this is followed by: for k, v in F.items(): D[k] = v

values() an object providing a view on D's values[source]#

D.values() -> an object providing a view on D’s values

where(self, attrs, first=False)[source]#

Return objects matching child objects properties.

Parameters:

attrs (dict) – tmux properties to match values of

Return type:

list