From 053835afbe404adb7c354a2b6e482ab691460d97 Mon Sep 17 00:00:00 2001 From: Kovid Goyal Date: Sun, 29 Apr 2018 18:16:41 +0530 Subject: [PATCH] Add an option to not request window attention on bell. Fixes #507 --- kitty/config.py | 1 + kitty/glfw.c | 2 +- kitty/kitty.conf | 4 ++++ kitty/state.c | 1 + kitty/state.h | 1 + 5 files changed, 8 insertions(+), 1 deletion(-) diff --git a/kitty/config.py b/kitty/config.py index 379749cb1..7e6178eeb 100644 --- a/kitty/config.py +++ b/kitty/config.py @@ -351,6 +351,7 @@ type_map = { 'inactive_text_alpha': unit_float, 'url_style': url_style, 'copy_on_select': to_bool, + 'window_alert_on_bell': to_bool, 'tab_bar_edge': tab_bar_edge, 'kitty_mod': to_modifiers, 'clear_all_shortcuts': to_bool, diff --git a/kitty/glfw.c b/kitty/glfw.c index 0bca63004..1bae1dbd9 100644 --- a/kitty/glfw.c +++ b/kitty/glfw.c @@ -620,7 +620,7 @@ request_window_attention(id_type kitty_window_id, bool audio_bell) { OSWindow *w = os_window_for_kitty_window(kitty_window_id); if (w) { if (audio_bell) ring_audio_bell(w); - glfwRequestWindowAttention(w->handle); + if (OPT(window_alert_on_bell)) glfwRequestWindowAttention(w->handle); glfwPostEmptyEvent(); } } diff --git a/kitty/kitty.conf b/kitty/kitty.conf index e54baa3bf..541232bbc 100644 --- a/kitty/kitty.conf +++ b/kitty/kitty.conf @@ -166,6 +166,10 @@ visual_bell_duration 0.0 # Enable/disable the audio bell. Useful in environments that require silence. enable_audio_bell yes + +# Request window attention on bell. +# Makes the dock icon bounce on macOS or the taskbar flash on linux. +window_alert_on_bell yes # }}} diff --git a/kitty/state.c b/kitty/state.c index d991582c7..93a5e7f00 100644 --- a/kitty/state.c +++ b/kitty/state.c @@ -373,6 +373,7 @@ PYWRAP1(set_options) { S(input_delay, repaint_delay); S(sync_to_monitor, PyObject_IsTrue); S(close_on_child_death, PyObject_IsTrue); + S(window_alert_on_bell, PyObject_IsTrue); S(macos_option_as_alt, PyObject_IsTrue); S(macos_hide_titlebar, PyObject_IsTrue); S(macos_hide_from_tasks, PyObject_IsTrue); diff --git a/kitty/state.h b/kitty/state.h index ead642d51..2914bf6cf 100644 --- a/kitty/state.h +++ b/kitty/state.h @@ -32,6 +32,7 @@ typedef struct { Edge tab_bar_edge; bool sync_to_monitor; bool close_on_child_death; + bool window_alert_on_bell; } Options; typedef struct {