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.

This commit is contained in:
Kovid Goyal 2018-05-02 22:02:45 +05:30
parent efcd3a5df7
commit f2afba2ef4
No known key found for this signature in database
GPG Key ID: 06BC317B515ACE7C
9 changed files with 19 additions and 6 deletions

View File

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

View File

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

View File

@ -64,7 +64,7 @@ def __call__(
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,

View File

@ -359,7 +359,7 @@ def url_style(x):
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):

View File

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

View File

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

View File

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

View File

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

View File

@ -88,6 +88,7 @@ def active_window_idx(self, val):
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 @@ def title_changed(self, window):
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):