From 2fe1b1e16ee5dd5709164ca4722fd9b9ae3bdfbd Mon Sep 17 00:00:00 2001 From: "Paul Gauthier (aider)" Date: Thu, 6 Mar 2025 11:55:32 -0800 Subject: [PATCH] feat: Add --notifications flag to control terminal bell --- aider/args.py | 6 ++++++ aider/io.py | 4 +++- 2 files changed, 9 insertions(+), 1 deletion(-) diff --git a/aider/args.py b/aider/args.py index 2a55b4d28..bdfe74e28 100644 --- a/aider/args.py +++ b/aider/args.py @@ -813,6 +813,12 @@ def get_parser(default_config_files, git_root): default=False, help="Enable/disable multi-line input mode with Meta-Enter to submit (default: False)", ) + group.add_argument( + "--notifications", + action=argparse.BooleanOptionalAction, + default=False, + help="Enable/disable terminal bell notifications when LLM responses are ready (default: False)", + ) group.add_argument( "--detect-urls", action=argparse.BooleanOptionalAction, diff --git a/aider/io.py b/aider/io.py index d4acc6bc4..7d95a422e 100644 --- a/aider/io.py +++ b/aider/io.py @@ -236,6 +236,7 @@ class InputOutput: file_watcher=None, multiline_mode=False, root=".", + notifications=False, ): self.placeholder = None self.interrupted = False @@ -243,6 +244,7 @@ class InputOutput: self.editingmode = editingmode self.multiline_mode = multiline_mode self.bell_on_next_input = False + self.notifications = notifications no_color = os.environ.get("NO_COLOR") if no_color is not None and no_color != "": pretty = False @@ -951,7 +953,7 @@ class InputOutput: def ring_bell(self): """Ring the terminal bell if needed and clear the flag""" - if self.bell_on_next_input: + if self.bell_on_next_input and self.notifications: print("\a", end="", flush=True) # Ring the bell self.bell_on_next_input = False # Clear the flag