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

View as Markdown

Module
session
Declared in
Session
Package
libtmux
Source
packages/libtmux/src/session.ts
Other languages
PythonRubyLuaRustGoJava.NETC++Swift
showHooks ( ) → Promise<ReadonlyMap<string, readonly string[]>>
method [source]
method [source]
showHooks

Every hook this session reports.

A hook is an array of commands, keyed by the name setHook takes, so what was set reads back under the name it was set with. tmux prints each element as name[0], which composes with neither of the writers.

In other ports Read a session's hooks

Examples

const hooks = await session.showHooks();
hooks.get("window-linked")?.[0];
>>> session.set_hook('session-renamed[0]', 'display-message "test"')
Session($...)
>>> hooks = session.show_hooks()
>>> isinstance(hooks, dict)
True
>>> 'session-renamed[0]' in hooks
True
>>> session.unset_hook('session-renamed')
Session($...)
let guard = libtmux::test::TestServer::new().await?;
let session = guard.server().new_session("hooked").await?;
session.set_hook("alert-bell", "display-message rang").await?;
let hooks = session.hooks().await?;
assert!(hooks.contains_key("alert-bell"));
guard.shutdown().await?;

0 declared, 0 inherited

Esc

Type to search.