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

Rust API

Rust documentation

server.Server.hooks

View as Markdown

Module
server
Declared in
Server
Package
libtmux
Source
crates/libtmux/src/server/settings.rs
Other languages
PythonTypeScript Go Java.NETC++Swift
hooks ( self ) → Result<BTreeMap<String, IndexedHooks>, Error>
method [source]
method [source]
hooks

Read every hook set at this server.

Only hooks holding something are reported: tmux lists every hook name it knows, and the ones holding nothing are absent here rather than present and empty.

Errors

Returns an error when tmux cannot be reached or refuses the listing.

In other ports Read the server's global hooks

Examples

let guard = libtmux::test::TestServer::new().await?;
let server = guard.server();
server.set_hook("alert-bell", "display-message rang").await?;
let hooks = server.hooks().await?;
assert!(hooks.contains_key("alert-bell"));
guard.shutdown().await?;
>>> 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($...)
const hooks = await server.showHooks();
hooks.get("session-created")?.[0];

0 declared, 0 inherited

Esc

Type to search.