Core LibrarystableAPI Reference

Choose documentation 3

stable

Current version

stable
English

Prerelease This site documents an alpha of libtmux. Its structure, URLs and APIs are subject to change.

Python API

method libtmux stable

Session.show_hook

Return value for a hook.

Source and package
Qualified name
libtmux.Session.show_hook
Module
libtmux
Declared in
Session
Package
libtmux
Source
src/libtmux/hooks.py
show_hook ( self, hook: str, global_: bool = False, scope: OptionScope | _DefaultOptionScope | None = DEFAULT_OPTION_SCOPE, ) → str | int | SparseArray[str] | None

Inherited from libtmux.hooks.HooksMixin

Description#

For array hooks (e.g., session-renamed), returns a SparseArray with hook values at their original indices. Use .keys() for indices and .values() for values.

Examples#

>>> session.set_hook('session-renamed[0]', 'display-message "test"')
Session($...)
>>> hooks = session.show_hook('session-renamed')
>>> isinstance(hooks, SparseArray)
True
>>> sorted(hooks.keys())
[0]
>>> session.unset_hook('session-renamed')
Session($...)
Parameters
Returns

str | int | SparseArray[str] | None Hook value. For array hooks, returns SparseArray.

Raises
Esc

Type to search.

Reference preview Open reference