diff --git a/CHANGELOG.md b/CHANGELOG.md index 098ed367..db279914 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -25,7 +25,8 @@ * **pipe-selected** key binding. Works like **pipe-visible** and **pipe-scrollback**, but only pipes the currently selected text, if any (https://codeberg.org/dnkl/foot/issues/51). -* **cursor.hide-when-typing** option to `footrc. +* **cursor.hide-when-typing** option to `footrc`. +* **cursor.indicate-when-selecting** option to `footrc`. ### Deprecated diff --git a/config.c b/config.c index 26d2d1a0..b31f0959 100644 --- a/config.c +++ b/config.c @@ -520,6 +520,9 @@ parse_section_cursor(const char *key, const char *value, struct config *conf, else if (strcmp(key, "hide-when-typing") == 0) conf->cursor.hide_when_typing = str_to_bool(value); + else if (strcmp(key, "indicate-when-selecting") == 0) + conf->cursor.indicate_when_selecting = str_to_bool(value); + else if (strcmp(key, "color") == 0) { char *value_copy = strdup(value); const char *text = strtok(value_copy, " "); @@ -1249,6 +1252,7 @@ config_load(struct config *conf, const char *conf_path, bool errors_are_fatal) .style = CURSOR_BLOCK, .blink = false, .hide_when_typing = false, + .indicate_when_selecting = true, .color = { .text = 0, .cursor = 0, diff --git a/config.h b/config.h index baee177d..ceeff554 100644 --- a/config.h +++ b/config.h @@ -75,6 +75,7 @@ struct config { enum cursor_style style; bool blink; bool hide_when_typing; + bool indicate_when_selecting; struct { uint32_t text; uint32_t cursor; diff --git a/doc/footrc.5.scd b/doc/footrc.5.scd index 8fbe7bd6..2d73ea1b 100644 --- a/doc/footrc.5.scd +++ b/doc/footrc.5.scd @@ -109,6 +109,10 @@ applications can change these at runtime. *hide-when-typing* Boolean. When enabled, the mouse cursor is hidden while typing. +*indicate-when-selecting* + Boolean. When enabled, the mouse cursor changes form to indicate + when the Shift key is held (for text selections). + *color* Two RRGGBB values specifying the foreground (text) and background (cursor) colors for the cursor. Default: inversed foreground and diff --git a/footrc b/footrc index 5bc6f24a..3d84fa0a 100644 --- a/footrc +++ b/footrc @@ -19,6 +19,7 @@ # color=111111 dcdccc # blink=no # hide-when-typing=no +# indicate-when-selecting=yes [colors] # alpha=1.0 diff --git a/terminal.c b/terminal.c index ae4f3ee5..fd286007 100644 --- a/terminal.c +++ b/terminal.c @@ -2213,7 +2213,7 @@ term_xcursor_update_for_seat(struct terminal *term, struct seat *seat) const char *xcursor = seat->pointer.hidden ? XCURSOR_HIDDEN : term->is_searching ? XCURSOR_LEFT_PTR - : selection_enabled(term, seat) ? XCURSOR_TEXT + : (selection_enabled(term, seat) && term->conf->cursor.indicate_when_selecting) ? XCURSOR_TEXT : XCURSOR_LEFT_PTR; render_xcursor_set(seat, term, xcursor);