libtmux Reference MCP Search
On this page

session.settings.Session.hook

View as Markdown

Module
session.settings
Declared in
Session
Package
libtmux
Source
crates/libtmux/src/session/settings.rs
hook ( self , name : &str ) Result<Option<IndexedHooks>, Error>
method [source]
method [source]
hook

Read one hook's commands, or None when it holds nothing.

Errors

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

Examples

let guard = libtmux::test::TestServer::new().await?;
let session = guard.server().new_session("hooked").await?;

assert!(session.hook("alert-bell").await?.is_none());
session.set_hook("alert-bell", "display-message rang").await?;
assert!(session.hook("alert-bell").await?.is_some());

guard.shutdown().await?;

0 declared, 0 inherited

Esc

Type to search.