aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorDaniel Eklöf <daniel@ekloef.se>2020-06-30 15:45:34 +0000
committerDaniel Eklöf <daniel@ekloef.se>2020-06-30 15:45:34 +0000
commita259eda5358b4fdb788b6fcf0f8e1482a5387d77 (patch)
treea20e1b0f3b1373b51d42d4281898c9ddb5013fcc
parentcsi: '\E[0 q' resets the cursor style to the default, not '\E[2 q' (diff)
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.
-rw-r--r--CHANGELOG.md4
-rw-r--r--config.c4
-rw-r--r--config.h1
-rw-r--r--doc/foot.5.scd7
-rw-r--r--footrc1
-rw-r--r--terminal.c3
-rw-r--r--terminal.h1
7 files changed, 19 insertions, 2 deletions
diff --git a/CHANGELOG.md b/CHANGELOG.md
index acb57cdf..b5a9d9c8 100644
--- a/CHANGELOG.md
+++ b/CHANGELOG.md
@@ -19,6 +19,9 @@
* Terminfo entries for keypad keys: `ka1`, `ka2`, `ka3`, `kb1`, `kb3`,
`kc1`, `kc2`, `kc3`, `kp5`, `kpADD`, `kpCMA`, `kpDIV`, `kpDOT`,
`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
@@ -108,6 +111,7 @@
`11t`, `13t`, `13;2t`, `14t`, `14;2t`, `15t`, `19t`.
* Unicode combining characters.
+
### Changed
* Spaces no longer removed from zsh font name completions.
diff --git a/config.c b/config.c
index 0d0b8cca..bf539442 100644
--- a/config.c
+++ b/config.c
@@ -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) {
char *value_copy = strdup(value);
const char *text = strtok(value_copy, " ");
@@ -873,6 +876,7 @@ config_load(struct config *conf, const char *conf_path)
.cursor = {
.style = CURSOR_BLOCK,
+ .blink = false,
.color = {
.text = 0,
.cursor = 0,
diff --git a/config.h b/config.h
index 969edea5..bb8ad1f4 100644
--- a/config.h
+++ b/config.h
@@ -33,6 +33,7 @@ struct config {
struct {
enum cursor_style style;
+ bool blink;
struct {
uint32_t text;
uint32_t cursor;
diff --git a/doc/foot.5.scd b/doc/foot.5.scd
index 4368d73d..7e746a3c 100644
--- a/doc/foot.5.scd
+++ b/doc/foot.5.scd
@@ -81,7 +81,12 @@ applications can change these runtime.
*style*
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*
Two RRGGBB values specifying the foreground (text) and background
diff --git a/footrc b/footrc
index c77c33c3..fe42c8eb 100644
--- a/footrc
+++ b/footrc
@@ -13,6 +13,7 @@
[cursor]
# style=block
# color=111111 dcdccc
+# blink=no
[colors]
# alpha=1.0
diff --git a/terminal.c b/terminal.c
index c5960c90..c6e03c24 100644
--- a/terminal.c
+++ b/terminal.c
@@ -844,10 +844,11 @@ term_init(const struct config *conf, struct fdm *fdm, struct reaper *reaper,
.alpha = conf->colors.alpha,
},
.origin = ORIGIN_ABSOLUTE,
+ .default_cursor_blink = conf->cursor.blink,
.default_cursor_style = conf->cursor.style,
.cursor_style = conf->cursor.style,
.cursor_blink = {
- .active = false,
+ .active = conf->cursor.blink,
.state = CURSOR_BLINK_ON,
.fd = cursor_blink_fd,
},
diff --git a/terminal.h b/terminal.h
index fc98d7cd..a9b8c5ca 100644
--- a/terminal.h
+++ b/terminal.h
@@ -296,6 +296,7 @@ struct terminal {
enum { CURSOR_BLINK_ON, CURSOR_BLINK_OFF } state;
int fd;
} cursor_blink;
+ bool default_cursor_blink;
struct {
uint32_t text;
uint32_t cursor;