config: add 'blink' option to cursor section in footrc

This option controls whether the default cursor should blink or
not. The default is to *not* blink.
This commit is contained in:
Daniel Eklöf 2020-06-30 17:45:34 +02:00
parent 7f65bd1c20
commit a259eda535
No known key found for this signature in database
GPG key ID: 5BBD4992C116573F
7 changed files with 19 additions and 2 deletions

View file

@ -19,6 +19,9 @@
* Terminfo entries for keypad keys: `ka1`, `ka2`, `ka3`, `kb1`, `kb3`, * Terminfo entries for keypad keys: `ka1`, `ka2`, `ka3`, `kb1`, `kb3`,
`kc1`, `kc2`, `kc3`, `kp5`, `kpADD`, `kpCMA`, `kpDIV`, `kpDOT`, `kc1`, `kc2`, `kc3`, `kp5`, `kpADD`, `kpCMA`, `kpDIV`, `kpDOT`,
`kpMUL`, `kpSUB` and `kpZRO`. `kpMUL`, `kpSUB` and `kpZRO`.
* **blink** option to `footrc`; a boolean that lets you control
whether the cursor should blink or not by default. Note that
applications can override this.
### Changed ### Changed
@ -108,6 +111,7 @@
`11t`, `13t`, `13;2t`, `14t`, `14;2t`, `15t`, `19t`. `11t`, `13t`, `13;2t`, `14t`, `14;2t`, `15t`, `19t`.
* Unicode combining characters. * Unicode combining characters.
### Changed ### Changed
* Spaces no longer removed from zsh font name completions. * Spaces no longer removed from zsh font name completions.

View file

@ -363,6 +363,9 @@ parse_section_cursor(const char *key, const char *value, struct config *conf,
} }
} }
else if (strcmp(key, "blink") == 0)
conf->cursor.blink = str_to_bool(value);
else if (strcmp(key, "color") == 0) { else if (strcmp(key, "color") == 0) {
char *value_copy = strdup(value); char *value_copy = strdup(value);
const char *text = strtok(value_copy, " "); const char *text = strtok(value_copy, " ");
@ -873,6 +876,7 @@ config_load(struct config *conf, const char *conf_path)
.cursor = { .cursor = {
.style = CURSOR_BLOCK, .style = CURSOR_BLOCK,
.blink = false,
.color = { .color = {
.text = 0, .text = 0,
.cursor = 0, .cursor = 0,

View file

@ -33,6 +33,7 @@ struct config {
struct { struct {
enum cursor_style style; enum cursor_style style;
bool blink;
struct { struct {
uint32_t text; uint32_t text;
uint32_t cursor; uint32_t cursor;

View file

@ -81,7 +81,12 @@ applications can change these runtime.
*style* *style*
Configures the default cursor style, and is one of: _block_, _bar_ Configures the default cursor style, and is one of: _block_, _bar_
or _underline_. Default: _block_. or _underline_. Note that this can be overridden by
applications. Default: _block_.
*blink*
Boolean. Enables blinking cursor. Note that this can be overridden
by applications. Default: _no_.
*color* *color*
Two RRGGBB values specifying the foreground (text) and background Two RRGGBB values specifying the foreground (text) and background

1
footrc
View file

@ -13,6 +13,7 @@
[cursor] [cursor]
# style=block # style=block
# color=111111 dcdccc # color=111111 dcdccc
# blink=no
[colors] [colors]
# alpha=1.0 # alpha=1.0

View file

@ -844,10 +844,11 @@ term_init(const struct config *conf, struct fdm *fdm, struct reaper *reaper,
.alpha = conf->colors.alpha, .alpha = conf->colors.alpha,
}, },
.origin = ORIGIN_ABSOLUTE, .origin = ORIGIN_ABSOLUTE,
.default_cursor_blink = conf->cursor.blink,
.default_cursor_style = conf->cursor.style, .default_cursor_style = conf->cursor.style,
.cursor_style = conf->cursor.style, .cursor_style = conf->cursor.style,
.cursor_blink = { .cursor_blink = {
.active = false, .active = conf->cursor.blink,
.state = CURSOR_BLINK_ON, .state = CURSOR_BLINK_ON,
.fd = cursor_blink_fd, .fd = cursor_blink_fd,
}, },

View file

@ -296,6 +296,7 @@ struct terminal {
enum { CURSOR_BLINK_ON, CURSOR_BLINK_OFF } state; enum { CURSOR_BLINK_ON, CURSOR_BLINK_OFF } state;
int fd; int fd;
} cursor_blink; } cursor_blink;
bool default_cursor_blink;
struct { struct {
uint32_t text; uint32_t text;
uint32_t cursor; uint32_t cursor;