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

window.Window.last_activity

Rust

View as Markdown

Module
window
Declared in
Window
Package
libtmux
Source
crates/libtmux/src/window.rs
Other languages
Python TypeScript Go Java .NET C++ Swift
last_activity ( self ) → SystemTime
method [source]
method [source]
last_activity

Return when the window last produced output.

tmux stamps this on every byte a pane in the window writes, whatever the window options say. That is what separates it from Self::has_activity , which is an alert and stays false unless monitor-activity was turned on -- and it is off by default.

tmux keeps whole seconds. WindowFields::window_activity filters and reads the same field as the i64 of Unix seconds tmux reports, because the query grammar compares integers.

Examples

use std::time::{Duration, SystemTime};
let guard = libtmux::test::TestServer::new().await?;
let session = guard.server().new_session("busy").await?;
let window = session.active_window().await?.expect("a window");
// A window that has just been made has already produced output.
let idle = SystemTime::now().duration_since(window.last_activity())?;
assert!(idle < Duration::from_secs(3600));
guard.shutdown().await?;
In other ports When a window last showed activity

0 declared, 0 inherited

Esc

Type to search.