Option to disable audio bell

This commit is contained in:
Kovid Goyal 2017-02-14 08:10:00 +05:30
parent d96c7d71a7
commit f7cb3e3f9e
3 changed files with 10 additions and 5 deletions

View File

@ -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,

View File

@ -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

View File

@ -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()