libtmux Reference MCP Search
On this page

session.Session.lock

View as Markdown

Module
session
Declared in
Session
Package
libtmux
Source
crates/libtmux/src/session.rs
lock ( self ) Result<(), Error>
method [source]
method [source]
lock

Lock every client attached to this session.

tmux runs the lock-command to lock, so what a locked client shows is that command's business rather than this one's.

Errors

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

Examples

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

// Locking a session nobody is attached to is accepted and does nothing.
session.lock().await?;

guard.shutdown().await?;

0 declared, 0 inherited

Esc

Type to search.