tmuxstatus

Source at the Bit Powder GitLab

Displays a tmux status line with the CPU utilization for the last 20 seconds, and the current memory usage. Daemon stops after 5 minutes (by default). On stop, can execute an user specified command, e.g. to suspend the computer.s

Example (using nerd-fonts):
█████▇█████████████▇▇████▇▇▇▇█ 56629M 08:01

Installation

Linux users can use the Bit Powder repo for Debian/Raspbian.

macOS users can use Homebrew with the following commands (upgrade with brew reinstall bitpowder/indigo-ng/tmuxstatus):

brew tap bitpowder/indigo-ng https://bitpowder.com:2443/bitpowder/indigo-ng.git
brew install --HEAD bitpowder/indigo-ng/tmuxstatus

If using Rust, install from crates.io:

cargo install tmuxstatus

Configuration

Add the following to your ~/.tmux.conf:

set -g status-interval 1
set -g status-right "#(tmuxstatus)  %H:%M "
set -g status-right-length "60"

To auto suspend after 5 minutes, use the following command:

set -g status-right "#(tmuxstatus --timeout 300 sudo systemctl suspend)  %H:%M "

Working

Creates a daemon on first use to avoid overhead. New invocations query this daemon so the overhead is reduced.

The overhead can be further reduced if tmux supports directly reading a status line using UNIX domain sockets instead of spawning a process.