brewedbits.dev

Personal blog with guides and news on selfhosting, Linux and AI, from the Netherlands

nextDash nextdash --aboutYour bookmarks. Your terminal. checks your links knows your Docker host one container, no cloudLive demo →nextdash.cc ↗

Tip: setw monitor-silence 30 highlights a tmux window that has gone quiet

Tmux
~/tips/tip-tmux-monitor-silence

tmux setw monitor-silence 30

Highlights a tmux window in the status bar after it has printed nothing for a set time.

tmux can already show which window printed something new. The opposite is just as useful for a long job: tell me when the output stops, because that often means it finished or got stuck.

The window option is monitor-silence, and it takes a number of seconds:

tmux setw monitor-silence 30

Per the manual, windows that have been silent for the interval are highlighted in the status line. An interval of zero turns the monitoring off. Set it on the window you care about and leave the global default alone, otherwise every idle shell lights up after 30 seconds.

The highlight is not the only possible reaction. The session option silence-action sets what happens when a window goes silent, with the same values as activity-action: any, none, current or other. With other, silence in the window you are looking at is ignored, which is what I want for a build running in another window:

tmux set -g silence-action other

Whether you get a bell or a message in the status line depends on the visual-silence option. The manual says that when monitor-silence is enabled, it prints a message after the interval has expired on a given window instead of sending a bell, and with both you get a bell and a message.

The caveat: silence does not mean done. A job that waits for input, or sits in a long computation without printing, looks the same as one that finished. I treat the highlight as a reason to go and look.

Further reading: tmux manual (monitor-silence)

More Tmux tips tmux new -d -s report -x 200 -y 50 'top' tmux wait-for build-done set -g allow-passthrough on tmux kill-server Ctrl-b [ All Tmux tips (125) All topics

Link