From f7cb3e3f9eaaf477a90fc16efe449f0dc9ab4b5c Mon Sep 17 00:00:00 2001 From: Kovid Goyal Date: Tue, 14 Feb 2017 08:10:00 +0530 Subject: [PATCH] Option to disable audio bell --- kitty/config.py | 1 + kitty/kitty.conf | 3 +++ kitty/window.py | 11 ++++++----- 3 files changed, 10 insertions(+), 5 deletions(-) diff --git a/kitty/config.py b/kitty/config.py index 6cf063230..33f6a0558 100644 --- a/kitty/config.py +++ b/kitty/config.py @@ -160,6 +160,7 @@ type_map = { 'window_border_width': float, 'wheel_scroll_multiplier': float, 'visual_bell_duration': float, + 'enable_audio_bell': to_bool, 'click_interval': float, 'mouse_hide_wait': float, 'cursor_blink_interval': float, diff --git a/kitty/kitty.conf b/kitty/kitty.conf index 17e1ac52f..484a49abf 100644 --- a/kitty/kitty.conf +++ b/kitty/kitty.conf @@ -91,6 +91,9 @@ repaint_delay 10 # seconds. Set to zero to disable. visual_bell_duration 0.0 +# Enable/disable the audio bell. Useful in environments that require silence. +enable_audio_bell yes + # The modifier keys to press when clicking with the mouse on URLs to open the URL open_url_modifiers ctrl+shift diff --git a/kitty/window.py b/kitty/window.py index a59a35933..ef2f1b6c4 100644 --- a/kitty/window.py +++ b/kitty/window.py @@ -108,11 +108,12 @@ class Window: wakeup() def bell(self): - try: - with open('/dev/tty', 'wb') as f: - f.write(b'\007') - except EnvironmentError: - pass # failure to beep is not critical + if self.opts.enable_audio_bell: + try: + with open('/dev/tty', 'wb') as f: + f.write(b'\007') + except EnvironmentError: + pass # failure to beep is not critical if self.opts.visual_bell_duration > 0: self.start_visual_bell_at = monotonic() glfw_post_empty_event()