diff --git a/CHANGELOG.rst b/CHANGELOG.rst index d0665c2c4..5e49dee35 100644 --- a/CHANGELOG.rst +++ b/CHANGELOG.rst @@ -6,9 +6,13 @@ kitty is a feature full, cross-platform, *fast*, GPU based terminal emulator. version 0.9.1 [future] ------------------------------ -- Show a bell on the tab if a bell occurs in one of the windows in the tab and +- Show a bell symbol on the tab if a bell occurs in one of the windows in the tab and the window is not the currently focused window +- Change the window border color if a bell occurs in an unfocused window. Can + be disabled by setting the bell_border_color to be the same as the + inactive_border_color. + - macOS: Add support for dead keys - Unicode input: When searching by name search for prefix matches as well as diff --git a/kitty/border_vertex.glsl b/kitty/border_vertex.glsl index e552b5da4..0bab76ab5 100644 --- a/kitty/border_vertex.glsl +++ b/kitty/border_vertex.glsl @@ -3,6 +3,7 @@ uniform uvec2 viewport; uniform vec3 default_bg; uniform vec3 active_border_color; uniform vec3 inactive_border_color; +uniform vec3 bell_border_color; in uvec4 rect; // left, top, right, bottom in uint rect_color; out vec3 color; @@ -37,5 +38,5 @@ void main() { gl_Position = vec4(to_opengl(rect[pos.x], rect[pos.y]), 0, 1); int rc = int(rect_color); vec3 window_bg = vec3(to_color(rect_color >> 24), to_color(rect_color >> 16), to_color(rect_color >> 8)); - color = float(1 & rc) * default_bg + float((2 & rc) >> 1) * active_border_color + float((4 & rc) >> 2) * inactive_border_color + float((8 & rc) >> 3) * window_bg; + color = float(1 & rc) * default_bg + float((2 & rc) >> 1) * active_border_color + float((4 & rc) >> 2) * inactive_border_color + float((8 & rc) >> 3) * window_bg + float((16 & rc) >> 4) * bell_border_color; } diff --git a/kitty/borders.py b/kitty/borders.py index b4131c2b1..58a8c19a2 100644 --- a/kitty/borders.py +++ b/kitty/borders.py @@ -64,7 +64,7 @@ class Borders: g = w.geometry if bw > 0 and draw_window_borders: # Draw the border rectangles - color = 2 if w is active_window else 4 + color = 2 if w is active_window else (16 if w.needs_attention else 4) border( self.os_window_id, self.tab_id, color, bw, g.left - fw, g.top - fw, g.right + fw, diff --git a/kitty/config.py b/kitty/config.py index d78a47e52..251162ab2 100644 --- a/kitty/config.py +++ b/kitty/config.py @@ -359,7 +359,7 @@ type_map = { for name in ( 'foreground background cursor active_border_color inactive_border_color' - ' selection_foreground selection_background url_color' + ' selection_foreground selection_background url_color bell_border_color' ).split(): type_map[name] = to_color for i in range(256): diff --git a/kitty/kitty.conf b/kitty/kitty.conf index 9935b9eae..6c224152c 100644 --- a/kitty/kitty.conf +++ b/kitty/kitty.conf @@ -202,6 +202,9 @@ active_border_color #00ff00 # The color for the border of inactive windows inactive_border_color #cccccc +# The color for the border of inactive windows in which a bell has occurred +bell_border_color #ff5a00 + # Fade the text in inactive windows by the specified amount (a number between # zero and one, with 0 being fully faded). inactive_text_alpha 1.0 diff --git a/kitty/shaders.c b/kitty/shaders.c index a43e460b1..1c8f0afc9 100644 --- a/kitty/shaders.c +++ b/kitty/shaders.c @@ -486,7 +486,7 @@ draw_cursor(CursorRenderInfo *cursor, bool is_focused) { // }}} // Borders {{{ -enum BorderUniforms { BORDER_viewport, BORDER_background_opacity, BORDER_default_bg, BORDER_active_border_color, BORDER_inactive_border_color, NUM_BORDER_UNIFORMS }; +enum BorderUniforms { BORDER_viewport, BORDER_background_opacity, BORDER_default_bg, BORDER_active_border_color, BORDER_inactive_border_color, BORDER_bell_border_color, NUM_BORDER_UNIFORMS }; static GLint border_uniform_locations[NUM_BORDER_UNIFORMS] = {0}; static void @@ -500,6 +500,7 @@ init_borders_program() { else if SET_LOC(default_bg); else if SET_LOC(active_border_color); else if SET_LOC(inactive_border_color); + else if SET_LOC(bell_border_color); else { fatal("Unknown uniform in borders program: %s", p->uniforms[i].name); return; } } if (left) { fatal("Left over uniforms in borders program"); return; } @@ -536,6 +537,7 @@ draw_borders(ssize_t vao_idx, unsigned int num_border_rects, BorderRect *rect_bu glUniform1f(border_uniform_locations[BORDER_background_opacity], OPT(background_opacity)); glUniform3f(border_uniform_locations[BORDER_active_border_color], CV3(OPT(active_border_color))); glUniform3f(border_uniform_locations[BORDER_inactive_border_color], CV3(OPT(inactive_border_color))); + glUniform3f(border_uniform_locations[BORDER_bell_border_color], CV3(OPT(bell_border_color))); } glUniform2ui(border_uniform_locations[BORDER_viewport], viewport_width, viewport_height); color_type default_bg = num_visible_windows > 1 ? OPT(background) : active_window_bg; diff --git a/kitty/state.c b/kitty/state.c index 8fedbcd53..25a5190fb 100644 --- a/kitty/state.c +++ b/kitty/state.c @@ -369,6 +369,7 @@ PYWRAP1(set_options) { S(background, color_as_int); S(active_border_color, color_as_int); S(inactive_border_color, color_as_int); + S(bell_border_color, color_as_int); S(repaint_delay, repaint_delay); S(input_delay, repaint_delay); S(sync_to_monitor, PyObject_IsTrue); diff --git a/kitty/state.h b/kitty/state.h index a8ebc323d..89243ade1 100644 --- a/kitty/state.h +++ b/kitty/state.h @@ -20,7 +20,7 @@ typedef struct { unsigned int rectangle_select_modifiers; unsigned int url_style; char_type select_by_word_characters[256]; size_t select_by_word_characters_count; - color_type url_color, background, active_border_color, inactive_border_color; + color_type url_color, background, active_border_color, inactive_border_color, bell_border_color; double repaint_delay, input_delay; bool focus_follows_mouse; bool macos_option_as_alt, macos_hide_titlebar, macos_hide_from_tasks; diff --git a/kitty/tabs.py b/kitty/tabs.py index 399a5f5bf..efa12ce4c 100644 --- a/kitty/tabs.py +++ b/kitty/tabs.py @@ -88,6 +88,7 @@ class Tab: # {{{ new_active_window.focus_changed(True) tm = self.tab_manager_ref() if tm is not None: + self.relayout_borders() tm.update_tab_bar() @property @@ -113,6 +114,7 @@ class Tab: # {{{ def on_bell(self, window): tm = self.tab_manager_ref() if tm is not None: + self.relayout_borders() tm.update_tab_bar() def visible_windows(self):