- Module
- session
- Declared in
- Session
- Package
- libtmux
- Source
- crates/libtmux/src/session/settings.rs
- Other languages
- PythonTypeScriptGoJava.NETC++Swift
-
Read every hook set at this session.
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 a session's hooks
- Python
libtmux.Session.show_hooks - TypeScript
session.Session.showHooks - Go
tmux.Session.Hooks - Java
io.github.libtmux.Session.Session.hooks - .NET
LibTmux.Session.Hooks - C++
libtmux::Session::hooks - Swift
Server.hooks(_:)
- Python
Examples
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?;>>> session.set_hook('session-renamed[0]', 'display-message "test"')Session($...)>>> hooks = session.show_hooks()>>> isinstance(hooks, dict)True>>> 'session-renamed[0]' in hooksTrue>>> session.unset_hook('session-renamed')Session($...)const hooks = await session.showHooks();hooks.get("window-linked")?.[0];0 declared, 0 inherited