Skip to content

Commit 50d7926

Browse files
committed
Merge branch 'add-cursor-trail-color-option' of https://github.com/CollinEMac/kitty
2 parents fbe982e + 7021271 commit 50d7926

File tree

8 files changed

+46
-3
lines changed

8 files changed

+46
-3
lines changed

kitty/options/definition.py

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -416,6 +416,18 @@
416416
'''
417417
)
418418

419+
opt('cursor_trail_color', 'none',
420+
option_type='to_color_or_none',
421+
ctype='!cursor_trail_color',
422+
long_text='''
423+
Set the color of the cursor trail when :opt:`cursor_trail` is enabled.
424+
If set to 'none' (the default), the cursor trail will use the cursor's
425+
background color. Otherwise, specify a color value (e.g., #ff0000 for red,
426+
or a named color like 'red'). This allows you to customize the appearance
427+
of the cursor trail independently of the cursor color.
428+
'''
429+
)
430+
419431
egr() # }}}
420432

421433
# scrollback {{{

kitty/options/parse.py

Lines changed: 3 additions & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

kitty/options/to-c-generated.h

Lines changed: 15 additions & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

kitty/options/to-c.h

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -215,6 +215,11 @@ cursor_trail_decay(PyObject *src, Options *opts) {
215215
opts->cursor_trail_decay_slow = PyFloat_AsFloat(PyTuple_GET_ITEM(src, 1));
216216
}
217217

218+
static inline void
219+
cursor_trail_color(PyObject *src, Options *opts) {
220+
opts->cursor_trail_color = color_or_none_as_int(src);
221+
}
222+
218223
static void
219224
parse_font_mod_size(PyObject *val, float *sz, AdjustmentUnit *unit) {
220225
PyObject *mv = PyObject_GetAttrString(val, "mod_value");

kitty/options/types.py

Lines changed: 4 additions & 1 deletion
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

kitty/options/utils.py

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -576,7 +576,6 @@ def cursor_trail_decay(x: str) -> tuple[float, float]:
576576
slow = max(slow, fast)
577577
return fast, slow
578578

579-
580579
def scrollback_lines(x: str) -> int:
581580
ans = int(x)
582581
if ans < 0:

kitty/shaders.c

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1252,7 +1252,12 @@ draw_cursor_trail(CursorTrail *trail, Window *active_window) {
12521252
glUniform2fv(trail_program_layout.uniforms.cursor_edge_x, 1, trail->cursor_edge_x);
12531253
glUniform2fv(trail_program_layout.uniforms.cursor_edge_y, 1, trail->cursor_edge_y);
12541254

1255-
color_vec3(trail_program_layout.uniforms.trail_color, active_window ? active_window->render_data.screen->last_rendered.cursor_bg : OPT(foreground));
1255+
color_type trail_color = OPT(cursor_trail_color);
1256+
if (trail_color == 0) { // 0 means "none" was specified
1257+
trail_color = active_window ? active_window->render_data.screen->last_rendered.cursor_bg : OPT(foreground);
1258+
}
1259+
color_vec3(trail_program_layout.uniforms.trail_color, trail_color);
1260+
12561261
glUniform1fv(trail_program_layout.uniforms.trail_opacity, 1, &trail->opacity);
12571262

12581263
glDrawArrays(GL_TRIANGLE_FAN, 0, 4);

kitty/state.h

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -54,6 +54,7 @@ typedef struct {
5454
monotonic_t cursor_trail;
5555
float cursor_trail_decay_fast;
5656
float cursor_trail_decay_slow;
57+
color_type cursor_trail_color;
5758
float cursor_trail_start_threshold;
5859
unsigned int url_style;
5960
unsigned int scrollback_pager_history_size;

0 commit comments

Comments
 (0)