Panes

class libtmux.Pane(window=None, **kwargs)

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

tmux(1) pane.

Parameters:windowWindow
Versionchanged:0.8 Renamed from .tmux to .cmd.
formatter_prefix = u’pane_’

namespace used TmuxMappingObject

cmd(cmd, *args, **kwargs)

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
send_keys(cmd, enter=True, suppress_history=True)

$ 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) – Send enter after sending the input.
  • suppress_history (bool) – Don’t add these keys to the shell history
clear()

Clear pane.

reset()

Reset and clear pane history.

split_window(attach=False, vertical=True, start_directory=None)

Split window at pane and return newly created Pane.

Parameters:
  • attach (bool) – Attach / select pane after creation.
  • vertical (bool) – split vertically
  • start_directory (str) – specifies the working directory in which the new pane is created.
Return type:

Pane.

set_width(width)

Set width of pane.

Parameters:width (int) – pane width, in cells.
set_height(height)

Set height of pane.

Parameters:height (int) – pane height, in cells.
resize_pane(*args, **kwargs)

$ tmux resize-pane of pane and return self.

Parameters:target_pane (str) – target_pane, or -U,“-D“, -L, -R.
Return type:Pane
enter()

Send carriage return to pane.

$ tmux send-keys send Enter to the pane.

select_pane()

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
find_where(attrs)

Return object on first match.

Versionchanged:0.4 Renamed from .findWhere to .find_where.
get(k[, d]) → D[k] if k in D, else d. d defaults to None.
get_by_id(id)

Return object based on child_id_attribute.

Based on .get() from backbone.js.

Parameters:id (str) –
Return type:object
items() → list of D’s (key, value) pairs, as 2-tuples
iteritems() → an iterator over the (key, value) items of D
iterkeys() → an iterator over the keys of D
itervalues() → an iterator over the values of D
keys()

Return list of keys.

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

as a 2-tuple; but raise KeyError if D is empty.

setdefault(k[, d]) → D.get(k,d), also set D[k]=d if k not in 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() → list of D’s values
where(attrs, first=False)

Return objects matching child objects properties.

Parameters:attrs (dict) – tmux properties to match
Return type:list