0

Are there any tmux plugins/snippets that display the time elapsed since the last moment the screen (or the content of each pane) changed?

It would be particularly helpful for monitoring streams of logs (e.g. via tailf).

Thank you.

1

Use the control mode (tmux -C) and parse the output.

Quick and dirty script, a proof of concept:

#!/bin/bash

pane="$1"
trap 'SECONDS=0; dte="$(date)"' USR1

unset TMUX
kill -s USR1 "$$"
tmux -C attach | while read -r a p z; do
   [ "$p" = "$pane" ] && kill -s USR1 "$$"
done &

while sleep 1; do printf '\r%-12d %s      ' "$SECONDS" "$dte"; done

Usage: ./scriptname %N where %N is the ID of the pane you want to monitor (e.g. %0; usually you can get it with echo "$TMUX_PANE"). Monitoring the pane where the script runs is possible but makes little sense.

Tested with tail -f /var/log/syslog in the monitored pane and logger elsewhere.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.