From 8a5e66848e6c4c4423dbf3eb4fbbfdd2575af357 Mon Sep 17 00:00:00 2001 From: Yan Lin Date: Wed, 30 Jul 2025 23:24:56 +0200 Subject: [PATCH 1/2] 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 ''; From e1beff433e4313c8a83377da55ff2f5a6b082c12 Mon Sep 17 00:00:00 2001 From: Yan Lin Date: Wed, 30 Jul 2025 23:26:36 +0200 Subject: [PATCH 2/2] Add monitor toggle --- README.md | 1 + 1 file changed, 1 insertion(+) diff --git a/README.md b/README.md index 19a5591..e323561 100644 --- a/README.md +++ b/README.md @@ -116,6 +116,7 @@ hms # Quick home-manager switch (rebuild) | `Ctrl+a H/J/K/L` | Resize panes | | `Ctrl+a r` | Reload tmux config | | `Ctrl+a Ctrl+a` | Quick pane cycling | +| `Ctrl+a A` | Toggle activity monitoring (useful for silencing noisy programs) | #### Copy Mode (Ctrl+a [): | Key | Action |