Core Library0.xAPI Reference

Choose documentation 3

latest

Current version

latest
English

Early release libtmux is released, and its APIs may still change between releases. This site's structure and URLs may change too.

method libtmux latest

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

tmux command#

The tmux commands behind show_hook.

tmux C API#

The C declarations in tmux that implement these commands.

Esc

Type to search.

Reference previewOpen reference