diff --git a/kitty/child-monitor.c b/kitty/child-monitor.c index dc24e9c91..36b88bb58 100644 --- a/kitty/child-monitor.c +++ b/kitty/child-monitor.c @@ -641,7 +641,14 @@ prepare_to_render_os_window(OSWindow *os_window, monotonic_t now, unsigned int * if (collect_cursor_info(&WD.screen->cursor_render_info, w, now, os_window)) needs_render = true; set_os_window_title_from_window(w, os_window); *active_window_bg = window_bg; - } else WD.screen->cursor_render_info.is_visible = false; + } else { + if (WD.screen->render_unfocused_cursor) { + if (collect_cursor_info(&WD.screen->cursor_render_info, w, now, os_window)) needs_render = true; + WD.screen->cursor_render_info.is_focused = false; + } else { + WD.screen->cursor_render_info.is_visible = false; + } + } if (scan_for_animated_images) { monotonic_t min_gap; if (scan_active_animations(WD.screen->grman, now, &min_gap, true)) needs_render = true; diff --git a/kitty/fast_data_types.pyi b/kitty/fast_data_types.pyi index 430cc8310..d855b27b5 100644 --- a/kitty/fast_data_types.pyi +++ b/kitty/fast_data_types.pyi @@ -1015,6 +1015,7 @@ class Screen: disable_ligatures: int cursor_key_mode: bool auto_repeat_enabled: bool + render_unfocused_cursor: int def __init__( self, diff --git a/kitty/screen.c b/kitty/screen.c index 3cbf73140..55258e77a 100644 --- a/kitty/screen.c +++ b/kitty/screen.c @@ -154,6 +154,7 @@ void screen_reset(Screen *self) { if (self->linebuf == self->alt_linebuf) screen_toggle_screen_buffer(self, true, true); if (self->overlay_line.is_active) deactivate_overlay_line(self); + self->render_unfocused_cursor = false; memset(self->main_key_encoding_flags, 0, sizeof(self->main_key_encoding_flags)); memset(self->alt_key_encoding_flags, 0, sizeof(self->alt_key_encoding_flags)); self->display_window_char = 0; @@ -3735,6 +3736,7 @@ static PyMemberDef members[] = { {"margin_top", T_UINT, offsetof(Screen, margin_top), READONLY, "margin_top"}, {"margin_bottom", T_UINT, offsetof(Screen, margin_bottom), READONLY, "margin_bottom"}, {"history_line_added_count", T_UINT, offsetof(Screen, history_line_added_count), 0, "history_line_added_count"}, + {"render_unfocused_cursor", T_UINT, offsetof(Screen, render_unfocused_cursor), 0, "render_unfocused_cursor"}, {NULL} }; diff --git a/kitty/screen.h b/kitty/screen.h index 1031aaeea..a7941d476 100644 --- a/kitty/screen.h +++ b/kitty/screen.h @@ -112,6 +112,7 @@ typedef struct { pthread_mutex_t read_buf_lock, write_buf_lock; CursorRenderInfo cursor_render_info; + unsigned int render_unfocused_cursor; struct { size_t capacity, used;