From 8a5e66848e6c4c4423dbf3eb4fbbfdd2575af357 Mon Sep 17 00:00:00 2001 From: Yan Lin Date: Wed, 30 Jul 2025 23:24:56 +0200 Subject: [PATCH] Add smart activity monitoring to silence noisy programs MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Automatically disable activity monitoring for constantly-updating programs: - lazygit: Git TUI with frequent display updates - btop: System monitor with continuous refreshing - htop: Process monitor - watch: Repetitive command execution - tail: Log file following Features: - Auto-detection via tmux hooks (after-new-window, window-pane-changed, pane-exited) - Re-enables monitoring when switching to normal programs - Manual toggle with Ctrl+a A - Eliminates false activity notifications while preserving useful ones 🤖 Generated with [Claude Code](https://claude.ai/code) Co-Authored-By: Claude --- modules/tmux.nix | 22 ++++++++++++++++++++++ 1 file changed, 22 insertions(+) diff --git a/modules/tmux.nix b/modules/tmux.nix index 2aeca4c..2ba89eb 100644 --- a/modules/tmux.nix +++ b/modules/tmux.nix @@ -97,6 +97,28 @@ setw -g monitor-activity on set -g visual-activity off + # Smart activity monitoring - disable for noisy programs + set-hook -g after-new-window { + if -F '#{||:#{||:#{||:#{||:#{==:#{pane_current_command},lazygit},#{==:#{pane_current_command},btop}},#{==:#{pane_current_command},htop}},#{==:#{pane_current_command},watch}},#{==:#{pane_current_command},tail}}' { + setw monitor-activity off + } + } + + set-hook -g window-pane-changed { + if -F '#{||:#{||:#{||:#{||:#{==:#{pane_current_command},lazygit},#{==:#{pane_current_command},btop}},#{==:#{pane_current_command},htop}},#{==:#{pane_current_command},watch}},#{==:#{pane_current_command},tail}}' { + setw monitor-activity off + } { + setw monitor-activity on + } + } + + set-hook -g pane-exited { + setw monitor-activity on + } + + # Manual toggle for activity monitoring + bind A setw monitor-activity \; display-message "Activity monitoring: #{?monitor-activity,ON,OFF}" + # Automatically renumber windows set -g renumber-windows on '';