Core Library0.xAPI Reference

Choose documentation 3

latest

Current version

latest
English

Early release libtmux is released, and its APIs may still change between releases. This site's structure and URLs may change too.

method libtmux-rs latest

Window.last_activity

Return when the window last produced output.

Source and package
Qualified name
libtmux::window::Window::last_activity
Module
window
Declared in
Window
Package
libtmux
Source
crates/libtmux/src/window.rs
Other languages
Perl Erlang PowerShell Julia Elixir Haskell Common Lisp Python Ruby Lua TypeScript Go Java C# C++ Swift Kotlin Scala OCaml F# Clojure
#[must_use] pub fn last_activity(&self) -> SystemTime

Description#

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

Equivalents of When a window last showed activity in other languages
Language Equivalent
Python libtmux.Window.window_activity
Haskell No public Haskell equivalent is implemented; the current modules expose scalar values and version parsing.
TypeScript no equivalent on Window
Go tmux.Window.Activity
Java no equivalent on Window
C# no equivalent on Window
C++ libtmux::Window::activity
Swift no equivalent on Window
OCaml No direct public OCaml equivalent is recorded for this operation.
Perl No dedicated equivalent in the selected Perl surface. Explicit Server::cmd remains available for native tmux commands.

No equivalent is recorded in Ruby, Lua, PowerShell, Julia, Erlang, Elixir, Common Lisp, Clojure, Kotlin, Scala or F#.

Esc

Type to search.

Reference previewOpen reference