Window.last_activity
Return when the window last produced output.
Source and package
-
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 unlessmonitor-activitywas turned on -- and it is off by default.tmux keeps whole seconds.
WindowFields::window_activityfilters and reads the same field as thei64of 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
| Language | Equivalent |
|---|---|
| Python | libtmux |
| Haskell | No public Haskell equivalent is implemented; the current modules expose scalar values and version parsing. |
| TypeScript | no equivalent on Window |
| Go | tmux |
| Java | no equivalent on Window |
| C# | no equivalent on Window |
| C++ | libtmux:: |
| 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#.