From 2c6f7adc17832c77b2353338b0c76c8a19f4112b Mon Sep 17 00:00:00 2001 From: Daniel Eklöf Date: Fri, 24 Jul 2020 18:20:26 +0200 Subject: config: add 'show-scrollback-position' option to footrc --- doc/foot.5.scd | 4 ++++ 1 file changed, 4 insertions(+) (limited to 'doc') diff --git a/doc/foot.5.scd b/doc/foot.5.scd index 92ac7c01..fd5a5d42 100644 --- a/doc/foot.5.scd +++ b/doc/foot.5.scd @@ -68,6 +68,10 @@ in this order: *scrollback* Number of scrollback lines. Default: _1000_. +*show-scrollback-position* + Boolean. Enables a position indicator when the viewport is not at + the bottom of the scrollback history. Default: _yes_. + *workers* Number of threads to use for rendering. Set to 0 to disable multithreading. Default: the number of available logical CPUs -- cgit v1.3 From e94506362028b57fa5d2c77f73a152a47cc06768 Mon Sep 17 00:00:00 2001 From: Daniel Eklöf Date: Fri, 24 Jul 2020 18:26:44 +0200 Subject: config: rename show-scrollback-position to scrollback-indicator --- config.c | 6 +++--- config.h | 2 +- doc/foot.5.scd | 2 +- render.c | 2 +- 4 files changed, 6 insertions(+), 6 deletions(-) (limited to 'doc') diff --git a/config.c b/config.c index 9666da61..e7ba74b2 100644 --- a/config.c +++ b/config.c @@ -291,8 +291,8 @@ parse_section_main(const char *key, const char *value, struct config *conf, conf->scrollback_lines = lines; } - else if (strcmp(key, "show-scrollback-position") == 0) - conf->show_scrollback_position = str_to_bool(value); + else if (strcmp(key, "scrollback-indicator") == 0) + conf->scrollback_indicator = str_to_bool(value); else { LOG_ERR("%s:%u: invalid key: %s", path, lineno, key); @@ -921,7 +921,7 @@ config_load(struct config *conf, const char *conf_path) .startup_mode = STARTUP_WINDOWED, .fonts = tll_init(), .scrollback_lines = 1000, - .show_scrollback_position = true, + .scrollback_indicator = true, .colors = { .fg = default_foreground, diff --git a/config.h b/config.h index c21e1160..f0f077be 100644 --- a/config.h +++ b/config.h @@ -40,7 +40,7 @@ struct config { tll(struct config_font) fonts; int scrollback_lines; - bool show_scrollback_position; + bool scrollback_indicator; struct { uint32_t fg; diff --git a/doc/foot.5.scd b/doc/foot.5.scd index fd5a5d42..1f71a8d3 100644 --- a/doc/foot.5.scd +++ b/doc/foot.5.scd @@ -68,7 +68,7 @@ in this order: *scrollback* Number of scrollback lines. Default: _1000_. -*show-scrollback-position* +*scrollback-indicator* Boolean. Enables a position indicator when the viewport is not at the bottom of the scrollback history. Default: _yes_. diff --git a/render.c b/render.c index 6611fbb9..d5cdb8dc 100644 --- a/render.c +++ b/render.c @@ -1290,7 +1290,7 @@ render_csd(struct terminal *term) static void render_scrollback_position(struct terminal *term) { - if (!term->conf->show_scrollback_position) + if (!term->conf->scrollback_indicator) return; /* Find absolute row number of the scrollback start */ -- cgit v1.3 From 5b868fd0c94af61e62a28a80a4bd337f9cbb25b4 Mon Sep 17 00:00:00 2001 From: Daniel Eklöf Date: Fri, 24 Jul 2020 18:34:19 +0200 Subject: config: add 'scrollback-indicator-format' option The value of this option must be either 'percent', or 'line', and determines _how_ we render the scrollback indicator. --- config.c | 14 ++++++++++++++ config.h | 1 + doc/foot.5.scd | 5 +++++ 3 files changed, 20 insertions(+) (limited to 'doc') diff --git a/config.c b/config.c index e7ba74b2..332fd11a 100644 --- a/config.c +++ b/config.c @@ -294,6 +294,19 @@ parse_section_main(const char *key, const char *value, struct config *conf, else if (strcmp(key, "scrollback-indicator") == 0) conf->scrollback_indicator = str_to_bool(value); + else if (strcmp(key, "scrollback-indicator-format") == 0) { + if (strcmp(value, "percent") == 0) + conf->scrollback_indicator_format = SCROLLBACK_INDICATOR_PERCENT; + else if (strcmp(value, "line") == 0) + conf->scrollback_indicator_format = SCROLLBACK_INDICATOR_LINENO; + else { + LOG_ERR("%s:%d: 'scrollback-indicator-format must be one " + "of 'percent' or 'line', not %s", + path, lineno, value); + return false; + } + } + else { LOG_ERR("%s:%u: invalid key: %s", path, lineno, key); return false; @@ -922,6 +935,7 @@ config_load(struct config *conf, const char *conf_path) .fonts = tll_init(), .scrollback_lines = 1000, .scrollback_indicator = true, + .scrollback_indicator_format = SCROLLBACK_INDICATOR_PERCENT, .colors = { .fg = default_foreground, diff --git a/config.h b/config.h index f0f077be..109eecb8 100644 --- a/config.h +++ b/config.h @@ -41,6 +41,7 @@ struct config { int scrollback_lines; bool scrollback_indicator; + enum {SCROLLBACK_INDICATOR_PERCENT, SCROLLBACK_INDICATOR_LINENO} scrollback_indicator_format; struct { uint32_t fg; diff --git a/doc/foot.5.scd b/doc/foot.5.scd index 1f71a8d3..485886fa 100644 --- a/doc/foot.5.scd +++ b/doc/foot.5.scd @@ -72,6 +72,11 @@ in this order: Boolean. Enables a position indicator when the viewport is not at the bottom of the scrollback history. Default: _yes_. +*scrollback-indicator-format* + Which format to use when displaying the scrollback position + indicator. Either _percent_ or _line_. This option is ignored if + *scrollback-indicator=no*. Default: _percent_. + *workers* Number of threads to use for rendering. Set to 0 to disable multithreading. Default: the number of available logical CPUs -- cgit v1.3 From c4679e474e0546ee8dad6e122c226ece85bdb134 Mon Sep 17 00:00:00 2001 From: Daniel Eklöf Date: Sat, 25 Jul 2020 14:31:45 +0200 Subject: config: rename scrollback-indicator to scrollback-indicator-style And turn it from a boolean to an enum. It can be set to: * `none` - disables the indicator * `static` - always rendered near the top of the window * `moving` - position reflects the scrollback position --- config.c | 37 ++++++++++++++++++++++++++----------- config.h | 19 ++++++++++++++++--- doc/foot.5.scd | 12 ++++++++---- footrc | 2 ++ render.c | 2 +- terminal.c | 2 +- 6 files changed, 54 insertions(+), 20 deletions(-) (limited to 'doc') diff --git a/config.c b/config.c index 332fd11a..7c4c9d9f 100644 --- a/config.c +++ b/config.c @@ -288,21 +288,33 @@ parse_section_main(const char *key, const char *value, struct config *conf, LOG_ERR("%s:%d: expected an integer: %s", path, lineno, value); return false; } - conf->scrollback_lines = lines; + conf->scrollback.lines = lines; } - else if (strcmp(key, "scrollback-indicator") == 0) - conf->scrollback_indicator = str_to_bool(value); + else if (strcmp(key, "scrollback-indicator") == 0) { + if (strcmp(value, "none") == 0) + conf->scrollback.indicator.style = SCROLLBACK_INDICATOR_STYLE_NONE; + else if (strcmp(value, "static") == 0) + conf->scrollback.indicator.style = SCROLLBACK_INDICATOR_STYLE_STATIC; + else if (strcmp(value, "moving") == 0) + conf->scrollback.indicator.style = SCROLLBACK_INDICATOR_STYLE_MOVING; + else { + LOG_ERR("%s:%d: scrollback-indicator-style must be one of " + "'none', 'static' or 'moving'", + path, lineno); + return false; + } + } else if (strcmp(key, "scrollback-indicator-format") == 0) { if (strcmp(value, "percent") == 0) - conf->scrollback_indicator_format = SCROLLBACK_INDICATOR_PERCENT; + conf->scrollback.indicator.format = SCROLLBACK_INDICATOR_FORMAT_PERCENT; else if (strcmp(value, "line") == 0) - conf->scrollback_indicator_format = SCROLLBACK_INDICATOR_LINENO; + conf->scrollback.indicator.format = SCROLLBACK_INDICATOR_FORMAT_LINENO; else { LOG_ERR("%s:%d: 'scrollback-indicator-format must be one " - "of 'percent' or 'line', not %s", - path, lineno, value); + "of 'percent' or 'line'", + path, lineno); return false; } } @@ -933,10 +945,13 @@ config_load(struct config *conf, const char *conf_path) .pad_y = 2, .startup_mode = STARTUP_WINDOWED, .fonts = tll_init(), - .scrollback_lines = 1000, - .scrollback_indicator = true, - .scrollback_indicator_format = SCROLLBACK_INDICATOR_PERCENT, - + .scrollback = { + .lines = 1000, + .indicator = { + .style = SCROLLBACK_INDICATOR_STYLE_MOVING, + .format = SCROLLBACK_INDICATOR_FORMAT_PERCENT, + }, + }, .colors = { .fg = default_foreground, .bg = default_background, diff --git a/config.h b/config.h index 109eecb8..9ff83b77 100644 --- a/config.h +++ b/config.h @@ -39,9 +39,22 @@ struct config { tll(struct config_font) fonts; - int scrollback_lines; - bool scrollback_indicator; - enum {SCROLLBACK_INDICATOR_PERCENT, SCROLLBACK_INDICATOR_LINENO} scrollback_indicator_format; + struct { + int lines; + + struct { + enum { + SCROLLBACK_INDICATOR_STYLE_NONE, + SCROLLBACK_INDICATOR_STYLE_STATIC, + SCROLLBACK_INDICATOR_STYLE_MOVING + } style; + + enum { + SCROLLBACK_INDICATOR_FORMAT_PERCENT, + SCROLLBACK_INDICATOR_FORMAT_LINENO + } format; + } indicator; + } scrollback; struct { uint32_t fg; diff --git a/doc/foot.5.scd b/doc/foot.5.scd index 485886fa..9813741c 100644 --- a/doc/foot.5.scd +++ b/doc/foot.5.scd @@ -68,14 +68,18 @@ in this order: *scrollback* Number of scrollback lines. Default: _1000_. -*scrollback-indicator* - Boolean. Enables a position indicator when the viewport is not at - the bottom of the scrollback history. Default: _yes_. +*scrollback-indicator-style* + Configures the style of the scrollback position indicator. One of + *none*, *static* or *moving*. *none* disables the indicator + completely. *static* always renders the indicator near the top at + the window, and *moving* renders the indicator at the position + corresponding to the current scrollback position. Default: + _moving_. *scrollback-indicator-format* Which format to use when displaying the scrollback position indicator. Either _percent_ or _line_. This option is ignored if - *scrollback-indicator=no*. Default: _percent_. + *scrollback-indicator-style=none*. Default: _percent_. *workers* Number of threads to use for rendering. Set to 0 to disable diff --git a/footrc b/footrc index 624c688b..911ebb28 100644 --- a/footrc +++ b/footrc @@ -2,6 +2,8 @@ # font=monospace # scrollback=1000 +# scrollback-indicator-style=moving +# scrollback-indicator-format=percent # geometry=700x500 # pad=2x2 # initial-window-mode=windowed diff --git a/render.c b/render.c index d5cdb8dc..bab87cf4 100644 --- a/render.c +++ b/render.c @@ -1290,7 +1290,7 @@ render_csd(struct terminal *term) static void render_scrollback_position(struct terminal *term) { - if (!term->conf->scrollback_indicator) + if (term->conf->scrollback.indicator.style == SCROLLBACK_INDICATOR_STYLE_NONE) return; /* Find absolute row number of the scrollback start */ diff --git a/terminal.c b/terminal.c index 86672f06..1e355fe3 100644 --- a/terminal.c +++ b/terminal.c @@ -909,7 +909,7 @@ term_init(const struct config *conf, struct fdm *fdm, struct reaper *reaper, .tab_stops = tll_init(), .wl = wayl, .render = { - .scrollback_lines = conf->scrollback_lines, + .scrollback_lines = conf->scrollback.lines, .app_sync_updates.timer_fd = app_sync_updates_fd, .workers = { .count = conf->render_worker_count, -- cgit v1.3 From e3be2cbd6f62baaa81dcae62b24731668ac764b5 Mon Sep 17 00:00:00 2001 From: Daniel Eklöf Date: Sat, 25 Jul 2020 14:38:36 +0200 Subject: config: rename scrollback-indicator-style value 'moving' to 'relative' --- config.c | 4 ++-- config.h | 2 +- doc/foot.5.scd | 6 +++--- footrc | 2 +- 4 files changed, 7 insertions(+), 7 deletions(-) (limited to 'doc') diff --git a/config.c b/config.c index 7c4c9d9f..59b824b8 100644 --- a/config.c +++ b/config.c @@ -297,7 +297,7 @@ parse_section_main(const char *key, const char *value, struct config *conf, else if (strcmp(value, "static") == 0) conf->scrollback.indicator.style = SCROLLBACK_INDICATOR_STYLE_STATIC; else if (strcmp(value, "moving") == 0) - conf->scrollback.indicator.style = SCROLLBACK_INDICATOR_STYLE_MOVING; + conf->scrollback.indicator.style = SCROLLBACK_INDICATOR_STYLE_RELATIVE; else { LOG_ERR("%s:%d: scrollback-indicator-style must be one of " "'none', 'static' or 'moving'", @@ -948,7 +948,7 @@ config_load(struct config *conf, const char *conf_path) .scrollback = { .lines = 1000, .indicator = { - .style = SCROLLBACK_INDICATOR_STYLE_MOVING, + .style = SCROLLBACK_INDICATOR_STYLE_RELATIVE, .format = SCROLLBACK_INDICATOR_FORMAT_PERCENT, }, }, diff --git a/config.h b/config.h index 9ff83b77..030bfc88 100644 --- a/config.h +++ b/config.h @@ -46,7 +46,7 @@ struct config { enum { SCROLLBACK_INDICATOR_STYLE_NONE, SCROLLBACK_INDICATOR_STYLE_STATIC, - SCROLLBACK_INDICATOR_STYLE_MOVING + SCROLLBACK_INDICATOR_STYLE_RELATIVE } style; enum { diff --git a/doc/foot.5.scd b/doc/foot.5.scd index 9813741c..496042b3 100644 --- a/doc/foot.5.scd +++ b/doc/foot.5.scd @@ -70,11 +70,11 @@ in this order: *scrollback-indicator-style* Configures the style of the scrollback position indicator. One of - *none*, *static* or *moving*. *none* disables the indicator + *none*, *static* or *relative*. *none* disables the indicator completely. *static* always renders the indicator near the top at - the window, and *moving* renders the indicator at the position + the window, and *relative* renders the indicator at the position corresponding to the current scrollback position. Default: - _moving_. + _relative_. *scrollback-indicator-format* Which format to use when displaying the scrollback position diff --git a/footrc b/footrc index 911ebb28..c2ee52e7 100644 --- a/footrc +++ b/footrc @@ -2,7 +2,7 @@ # font=monospace # scrollback=1000 -# scrollback-indicator-style=moving +# scrollback-indicator-style=relative # scrollback-indicator-format=percent # geometry=700x500 # pad=2x2 -- cgit v1.3 From 9edd71a741a3aeff89fe04f51582214d69bbde5d Mon Sep 17 00:00:00 2001 From: Daniel Eklöf Date: Sat, 25 Jul 2020 14:40:46 +0200 Subject: config: rename scrollback-indicator-style value 'static' to 'fixed' --- config.c | 6 +++--- config.h | 2 +- doc/foot.5.scd | 4 ++-- 3 files changed, 6 insertions(+), 6 deletions(-) (limited to 'doc') diff --git a/config.c b/config.c index 59b824b8..b6af1d26 100644 --- a/config.c +++ b/config.c @@ -294,9 +294,9 @@ parse_section_main(const char *key, const char *value, struct config *conf, else if (strcmp(key, "scrollback-indicator") == 0) { if (strcmp(value, "none") == 0) conf->scrollback.indicator.style = SCROLLBACK_INDICATOR_STYLE_NONE; - else if (strcmp(value, "static") == 0) - conf->scrollback.indicator.style = SCROLLBACK_INDICATOR_STYLE_STATIC; - else if (strcmp(value, "moving") == 0) + else if (strcmp(value, "fixed") == 0) + conf->scrollback.indicator.style = SCROLLBACK_INDICATOR_STYLE_FIXED; + else if (strcmp(value, "relative") == 0) conf->scrollback.indicator.style = SCROLLBACK_INDICATOR_STYLE_RELATIVE; else { LOG_ERR("%s:%d: scrollback-indicator-style must be one of " diff --git a/config.h b/config.h index 030bfc88..57701606 100644 --- a/config.h +++ b/config.h @@ -45,7 +45,7 @@ struct config { struct { enum { SCROLLBACK_INDICATOR_STYLE_NONE, - SCROLLBACK_INDICATOR_STYLE_STATIC, + SCROLLBACK_INDICATOR_STYLE_FIXED, SCROLLBACK_INDICATOR_STYLE_RELATIVE } style; diff --git a/doc/foot.5.scd b/doc/foot.5.scd index 496042b3..573eb313 100644 --- a/doc/foot.5.scd +++ b/doc/foot.5.scd @@ -70,8 +70,8 @@ in this order: *scrollback-indicator-style* Configures the style of the scrollback position indicator. One of - *none*, *static* or *relative*. *none* disables the indicator - completely. *static* always renders the indicator near the top at + *none*, *fixed* or *relative*. *none* disables the indicator + completely. *fixed* always renders the indicator near the top at the window, and *relative* renders the indicator at the position corresponding to the current scrollback position. Default: _relative_. -- cgit v1.3 From 50d116dcb9183047899d93095117632c669d5f03 Mon Sep 17 00:00:00 2001 From: Daniel Eklöf Date: Sun, 26 Jul 2020 11:39:02 +0200 Subject: config: scrollback-indicator-format: percent -> percentage --- config.c | 14 ++++++++------ config.h | 2 +- doc/foot.5.scd | 4 ++-- footrc | 2 +- render.c | 2 +- 5 files changed, 13 insertions(+), 11 deletions(-) (limited to 'doc') diff --git a/config.c b/config.c index f87eb67f..2b989d62 100644 --- a/config.c +++ b/config.c @@ -307,11 +307,13 @@ parse_section_main(const char *key, const char *value, struct config *conf, } else if (strcmp(key, "scrollback-indicator-format") == 0) { - if (strcmp(value, "percent") == 0) - conf->scrollback.indicator.format = SCROLLBACK_INDICATOR_FORMAT_PERCENT; - else if (strcmp(value, "line") == 0) - conf->scrollback.indicator.format = SCROLLBACK_INDICATOR_FORMAT_LINENO; - else { + if (strcmp(value, "percent") == 0) { + conf->scrollback.indicator.format + = SCROLLBACK_INDICATOR_FORMAT_PERCENTAGE; + } else if (strcmp(value, "line") == 0) { + conf->scrollback.indicator.format + = SCROLLBACK_INDICATOR_FORMAT_LINENO; + } else { LOG_ERR("%s:%d: 'scrollback-indicator-format must be one " "of 'percent' or 'line'", path, lineno); @@ -949,7 +951,7 @@ config_load(struct config *conf, const char *conf_path) .lines = 1000, .indicator = { .style = SCROLLBACK_INDICATOR_STYLE_RELATIVE, - .format = SCROLLBACK_INDICATOR_FORMAT_PERCENT, + .format = SCROLLBACK_INDICATOR_FORMAT_PERCENTAGE, }, }, .colors = { diff --git a/config.h b/config.h index 57701606..456019b5 100644 --- a/config.h +++ b/config.h @@ -50,7 +50,7 @@ struct config { } style; enum { - SCROLLBACK_INDICATOR_FORMAT_PERCENT, + SCROLLBACK_INDICATOR_FORMAT_PERCENTAGE, SCROLLBACK_INDICATOR_FORMAT_LINENO } format; } indicator; diff --git a/doc/foot.5.scd b/doc/foot.5.scd index 573eb313..c348391b 100644 --- a/doc/foot.5.scd +++ b/doc/foot.5.scd @@ -78,8 +78,8 @@ in this order: *scrollback-indicator-format* Which format to use when displaying the scrollback position - indicator. Either _percent_ or _line_. This option is ignored if - *scrollback-indicator-style=none*. Default: _percent_. + indicator. Either _percentage_ or _line_. This option is ignored + if *scrollback-indicator-style=none*. Default: _percentage_. *workers* Number of threads to use for rendering. Set to 0 to disable diff --git a/footrc b/footrc index c2ee52e7..3ab2e6c1 100644 --- a/footrc +++ b/footrc @@ -3,7 +3,7 @@ # font=monospace # scrollback=1000 # scrollback-indicator-style=relative -# scrollback-indicator-format=percent +# scrollback-indicator-format=percentage # geometry=700x500 # pad=2x2 # initial-window-mode=windowed diff --git a/render.c b/render.c index 55213408..6e8a56d4 100644 --- a/render.c +++ b/render.c @@ -1363,7 +1363,7 @@ render_scrollback_position(struct terminal *term) /* *What* to render */ switch (term->conf->scrollback.indicator.format) { - case SCROLLBACK_INDICATOR_FORMAT_PERCENT: + case SCROLLBACK_INDICATOR_FORMAT_PERCENTAGE: swprintf(text, sizeof(text) / sizeof(text[0]), L"%u%%", percent); cell_count = 3; break; -- cgit v1.3 From 77afd615251ebff7b090454c180a5f5470cb97e3 Mon Sep 17 00:00:00 2001 From: Daniel Eklöf Date: Mon, 27 Jul 2020 16:45:34 +0200 Subject: doc: foot.5: modifiers+keys are plural --- doc/foot.5.scd | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'doc') diff --git a/doc/foot.5.scd b/doc/foot.5.scd index 7c3ab283..d837cd1a 100644 --- a/doc/foot.5.scd +++ b/doc/foot.5.scd @@ -176,7 +176,7 @@ This section lets you override the default key bindings. The general format is _action=combo1...comboN_. That is, each action may have one or more key combinations, space separated. Each combination is on the form _mod1+mod2+key_. The names of the modifiers -and the key *must* be a valid XKB key name. +and the key *must* be valid XKB key names. Note that if *Shift* is one of the modifiers, the _key_ *must* be in upper case. For example, *Control+Shift+v* will never trigger - -- cgit v1.3 From 718e5b4a7787cc9d68b9c422b8b6703f3b7c5c26 Mon Sep 17 00:00:00 2001 From: Daniel Eklöf Date: Mon, 27 Jul 2020 20:02:51 +0200 Subject: config: rename scrollback-indicator-style to scrollback-indicator-position --- CHANGELOG.md | 2 +- config.c | 12 ++++++------ config.h | 8 ++++---- doc/foot.5.scd | 4 ++-- footrc | 2 +- render.c | 10 +++++----- 6 files changed, 19 insertions(+), 19 deletions(-) (limited to 'doc') diff --git a/CHANGELOG.md b/CHANGELOG.md index 35669232..dc6fc301 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -20,7 +20,7 @@ * Mouse cursor is now always a `left_ptr` when inside the margins, to indicate it is not possible to start a selection. * Scrollback position indicator. This feature is optional and - controlled by the **scrollback-indicator-style** and + controlled by the **scrollback-indicator-position** and **scrollback-indicator-format** options in `footrc` (https://codeberg.org/dnkl/foot/issues/42). diff --git a/config.c b/config.c index 2b989d62..169b2b40 100644 --- a/config.c +++ b/config.c @@ -291,15 +291,15 @@ parse_section_main(const char *key, const char *value, struct config *conf, conf->scrollback.lines = lines; } - else if (strcmp(key, "scrollback-indicator-style") == 0) { + else if (strcmp(key, "scrollback-indicator-position") == 0) { if (strcmp(value, "none") == 0) - conf->scrollback.indicator.style = SCROLLBACK_INDICATOR_STYLE_NONE; + conf->scrollback.indicator.position = SCROLLBACK_INDICATOR_POSITION_NONE; else if (strcmp(value, "fixed") == 0) - conf->scrollback.indicator.style = SCROLLBACK_INDICATOR_STYLE_FIXED; + conf->scrollback.indicator.position = SCROLLBACK_INDICATOR_POSITION_FIXED; else if (strcmp(value, "relative") == 0) - conf->scrollback.indicator.style = SCROLLBACK_INDICATOR_STYLE_RELATIVE; + conf->scrollback.indicator.position = SCROLLBACK_INDICATOR_POSITION_RELATIVE; else { - LOG_ERR("%s:%d: scrollback-indicator-style must be one of " + LOG_ERR("%s:%d: scrollback-indicator-position must be one of " "'none', 'fixed' or 'moving'", path, lineno); return false; @@ -950,7 +950,7 @@ config_load(struct config *conf, const char *conf_path) .scrollback = { .lines = 1000, .indicator = { - .style = SCROLLBACK_INDICATOR_STYLE_RELATIVE, + .position = SCROLLBACK_INDICATOR_POSITION_RELATIVE, .format = SCROLLBACK_INDICATOR_FORMAT_PERCENTAGE, }, }, diff --git a/config.h b/config.h index 456019b5..eee01e65 100644 --- a/config.h +++ b/config.h @@ -44,10 +44,10 @@ struct config { struct { enum { - SCROLLBACK_INDICATOR_STYLE_NONE, - SCROLLBACK_INDICATOR_STYLE_FIXED, - SCROLLBACK_INDICATOR_STYLE_RELATIVE - } style; + SCROLLBACK_INDICATOR_POSITION_NONE, + SCROLLBACK_INDICATOR_POSITION_FIXED, + SCROLLBACK_INDICATOR_POSITION_RELATIVE + } position; enum { SCROLLBACK_INDICATOR_FORMAT_PERCENTAGE, diff --git a/doc/foot.5.scd b/doc/foot.5.scd index 188e8edf..949e2751 100644 --- a/doc/foot.5.scd +++ b/doc/foot.5.scd @@ -68,7 +68,7 @@ in this order: *scrollback* Number of scrollback lines. Default: _1000_. -*scrollback-indicator-style* +*scrollback-indicator-position* Configures the style of the scrollback position indicator. One of *none*, *fixed* or *relative*. *none* disables the indicator completely. *fixed* always renders the indicator near the top at @@ -79,7 +79,7 @@ in this order: *scrollback-indicator-format* Which format to use when displaying the scrollback position indicator. Either _percentage_ or _line_. This option is ignored - if *scrollback-indicator-style=none*. Default: _percentage_. + if *scrollback-indicator-position=none*. Default: _percentage_. *workers* Number of threads to use for rendering. Set to 0 to disable diff --git a/footrc b/footrc index 117b73fe..900ce149 100644 --- a/footrc +++ b/footrc @@ -2,7 +2,7 @@ # font=monospace # scrollback=1000 -# scrollback-indicator-style=relative +# scrollback-indicator-position=relative # scrollback-indicator-format=percentage # geometry=700x500 # pad=2x2 diff --git a/render.c b/render.c index 59601c05..195839fb 100644 --- a/render.c +++ b/render.c @@ -1290,7 +1290,7 @@ render_csd(struct terminal *term) static void render_scrollback_position(struct terminal *term) { - if (term->conf->scrollback.indicator.style == SCROLLBACK_INDICATOR_STYLE_NONE) + if (term->conf->scrollback.indicator.position == SCROLLBACK_INDICATOR_POSITION_NONE) return; struct wayland *wayl = term->wl; @@ -1414,16 +1414,16 @@ render_scrollback_position(struct terminal *term) /* *Where* to render - parent relative coordinates */ int surf_top = 0; - switch (term->conf->scrollback.indicator.style) { - case SCROLLBACK_INDICATOR_STYLE_NONE: + switch (term->conf->scrollback.indicator.position) { + case SCROLLBACK_INDICATOR_POSITION_NONE: assert(false); return; - case SCROLLBACK_INDICATOR_STYLE_FIXED: + case SCROLLBACK_INDICATOR_POSITION_FIXED: surf_top = term->cell_height - margin; break; - case SCROLLBACK_INDICATOR_STYLE_RELATIVE: { + case SCROLLBACK_INDICATOR_POSITION_RELATIVE: { int lines = term->rows - 3; /* Avoid using first and two last rows */ assert(lines > 0); -- cgit v1.3 From 62c4f1e5b428306b479235592d3cabb84eb7f130 Mon Sep 17 00:00:00 2001 From: Daniel Eklöf Date: Mon, 27 Jul 2020 20:04:56 +0200 Subject: doc: rename foot.5 -> footrc.5 --- CHANGELOG.md | 1 + README.md | 7 +- doc/foot.1.scd | 6 +- doc/foot.5.scd | 413 ------------------------------------------------------- doc/footrc.5.scd | 413 +++++++++++++++++++++++++++++++++++++++++++++++++++++++ doc/meson.build | 2 +- 6 files changed, 422 insertions(+), 420 deletions(-) delete mode 100644 doc/foot.5.scd create mode 100644 doc/footrc.5.scd (limited to 'doc') diff --git a/CHANGELOG.md b/CHANGELOG.md index dc6fc301..57c01110 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -17,6 +17,7 @@ ### Removed ### Changed +* Renamed man page for `footrc` from **foot**(5) to **footrc**(5). * Mouse cursor is now always a `left_ptr` when inside the margins, to indicate it is not possible to start a selection. * Scrollback position indicator. This feature is optional and diff --git a/README.md b/README.md index 233703d1..d784b4fc 100644 --- a/README.md +++ b/README.md @@ -55,11 +55,12 @@ The fast, lightweight and minimalistic Wayland terminal emulator. ## Configuration -**foot** can be configured by creating a file `$XDG_CONFIG_HOME/footrc` (defaulting to `~/.config/footrc`). -A template for that can usually be found in `/usr/share/foot/footrc` or +**foot** can be configured by creating a file +`$XDG_CONFIG_HOME/footrc` (defaulting to `~/.config/footrc`). A +template for that can usually be found in `/usr/share/foot/footrc` or [here](https://codeberg.org/dnkl/foot/src/branch/master/footrc). -Further information can be found in foot's manpage `foot(5)`. +Further information can be found in foot's man page `footrc(5)`. ## Troubleshooting diff --git a/doc/foot.1.scd b/doc/foot.1.scd index 883ae8b1..c22eea70 100644 --- a/doc/foot.1.scd +++ b/doc/foot.1.scd @@ -119,7 +119,7 @@ The following keyboard shortcuts are available. ## NORMAL MODE Note that these are just the defaults; they can be changed in the -*footrc*, see *foot*(5). +*footrc*, see *footrc*(5). *shift*+*page up*/*page down* Scroll up/down in history @@ -239,7 +239,7 @@ Finally, pressing *alt* will prefix the transmitted byte with ESC. # CONFIGURATION -See *foot*(5) +See *footrc*(5) # BUGS @@ -256,4 +256,4 @@ The report should contain the following: # SEE ALSO -*foot*(5), *footclient*(1) +*footrc*(5), *footclient*(1) diff --git a/doc/foot.5.scd b/doc/foot.5.scd deleted file mode 100644 index 949e2751..00000000 --- a/doc/foot.5.scd +++ /dev/null @@ -1,413 +0,0 @@ -foot(5) - -# NAME -foot - configuration file - -# DESCRIPTION - -*foot* uses the standard _unix configuration format_, with section based -key/value pairs. The default section is unnamed (i.e. not prefixed -with a _[section]_). - -foot will search for a configuration file in the following locations, -in this order: - -- _XDG_CONFIG_HOME/footrc_ -- _~/.config/footrc_ - -# SECTION: default - -*font* - Comma separated list of fonts to use, in fontconfig format (see - *FONT FORMAT*). - - The first font is the primary font. The remaining fonts are - fallback fonts that will be used whenever a glyph cannot be found - in the primary font. - - The fallback fonts are searched in the order they appear. If a - glyph cannot be found in any of the fallback fonts, the dynamic - fallback list from fontconfig (for the primary font) is - searched. - - Default: _monospace_. - -*geometry* - Initial window width and height in pixels (subject to output - scaling), on the form _WIDTHxHEIGHT_. Default: _700x500_. - -*pad* - Padding between border and glyphs, in pixels (subject to output - scaling), on the form _XxY_. Default: _2x2_. - -*initial-window-mode* - Initial window mode for each newly spawned window: *windowed*, - *maximized* or *fullscreen*. Default: _windowed_. - -*shell* - Executable to launch. Typically a shell. Default: _$SHELL_ if set, - otherwise the user's default shell (as specified in - _/etc/passwd_). You can also pass arguments. For example - "/bin/bash --norc". - -*login-shell* - Boolean. If enabled, the shell will be launched as a login shell, - by prepending a '-' to argv[0]. Default: _no_. - -*term* - Value to set the environment variable *TERM* to. Default: _foot_. - -*title* - Initial window title. Default: _foot_. - -*app-id* - Value to set the *app-id* property on the Wayland window to. The - compositor can use this value to e.g. group multiple windows, or - apply window management rules. Default: _foot_. - -*scrollback* - Number of scrollback lines. Default: _1000_. - -*scrollback-indicator-position* - Configures the style of the scrollback position indicator. One of - *none*, *fixed* or *relative*. *none* disables the indicator - completely. *fixed* always renders the indicator near the top at - the window, and *relative* renders the indicator at the position - corresponding to the current scrollback position. Default: - _relative_. - -*scrollback-indicator-format* - Which format to use when displaying the scrollback position - indicator. Either _percentage_ or _line_. This option is ignored - if *scrollback-indicator-position=none*. Default: _percentage_. - -*workers* - Number of threads to use for rendering. Set to 0 to disable - multithreading. Default: the number of available logical CPUs - (including SMT). Note that this is not always the best value. In - some cases, the number of physical _cores_ is better. - - -# SECTION: cursor - -This section controls the cursor style and color. Note that -applications can change these at runtime. - -*style* - Configures the default cursor style, and is one of: _block_, _bar_ - 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 - (cursor) colors for the cursor. Default: inversed foreground and - background colors. Note that this value only applies to the block - cursor. The other cursor styles are always rendered with the - foreground color. - -# SECTION: colors - -This section controls the 16 ANSI colors and the default foreground -and background colors. Note that applications can change these at -runtime. - -The colors are in RRGGBB format. That is, they do *not* have an alpha -component. You can configure the background transparency with the -_alpha_ option. - -*foreground* - Default RRGGBB foreground color. This is the color used when no - ANSI color is being used. Default: _dcdccc_. - -*background* - Default RRGGBB background color. This is the color used when no - ANSI color is being used. Default: _111111_. - -*regular0*, *regular1* *..* *regular7* - The eight basic ANSI colors. Default: _222222_, _cc9393_, - _7f9f7f_, _d0bf8f_, _6ca0a3_, _dc8cc3_, _93e0e3_ and _dcdccc_ (a - variant of the _zenburn_ theme). - -*bright0*, *bright1* *..* *bright7* - The eight bright ANSI colors. Default: _666666_, _dca3a3_, - _bfebbf_, _f0dfaf_, _8cd0d3_, _fcace3_, _b3ffff_ and _ffffff_ (a - variant of the _zenburn_ theme). - -*alpha* - Background translucency. A value in the range 0.0-1.0, where 0.0 - means completely transparent, and 1.0 is opaque. Default: _1.0_. - -# SECTION: csd - -This section controls the look of the _CSDs_ (Client Side -Decorations). Note that the default is to *not* use CSDs, but instead -to use _SSDs_ (Server Side Decorations) when the compositor supports -it. - -Note that unlike the colors defined in the _colors_ section, the color -values here are in AARRGGBB format. I.e. they contain an alpha -component. - -*preferred* - Which type of window decorations to prefer: *client* (CSD) or - *server* (SSD). Note that this is only a hint to the - compositor. Depending on the compositor's configuration and - capabilities, it may not have any effect. Default: _server_. - -*size* - Height, in pixels (subject to output scaling), of the - titlebar. Default: _26_. - -*color* - Titlebar AARRGGBB color. Default: use the default _foreground_ - color. - -*button-width* - Width, in pixels (subject to output scaling), of the - minimize/maximize/close buttons. Default: _26_. - -*button-minimize-color* - Minimize button's AARRGGBB color. Default: use the default - _regular4_ color (blue). - -*button-maximize-color* - Maximize button's AARRGGBB color. Default: use the default - _regular2_ color (green). - -*button-close-color* - Close button's AARRGGBB color. Default: use the default _regular1_ - color (red). - -# SECTION: key-bindings - -This section lets you override the default key bindings. - -The general format is _action=combo1...comboN_. That is, each action -may have one or more key combinations, space separated. Each -combination is on the form _mod1+mod2+key_. The names of the modifiers -and the key *must* be valid XKB key names. - -Note that if *Shift* is one of the modifiers, the _key_ *must* be in -upper case. For example, *Control+Shift+v* will never trigger - -*Control+Shift+V* is the correct way to write it. - -Note that *Alt* is usually called *Mod1*. - -A key combination can only be mapped to *one* action. Lets say you -want to bind *Control+Shift+R* to *fullscreen*. Since this is the -default shortcut for *search-start*, you first need to unmap the -default binding. This can be done by setting _action=none_; -e.g. *search-start=none*. - -*scrollback-up* - Scrolls up/back in history. Default: _Shift+Page\_Up_. - -*scrollback-down* - Scroll down/forward in history. Default: _Shift+Page\_Down_. - -*clipboard-copy* - Copies the current selection into the _clipboard_. Default: _Control+Shift+C_. - -*clipboard-paste* - Pastes from the _clipboard_. Default: _Control+Shift+V_. - -*primary-paste* - Pastes from the _primary selection_. Default: not bound (to a - _key_, see *mouse-bindings*). - -*search-start* - Starts a scrollback/history search. Default: _Control+Shift+R_. - -*font-increase* - Increases the font size by 0.5pt. Default: _Control+plus - Control+equal Control+KP\_Add_. - -*font-decrease* - Decreases the font size by 0.5pt. Default: _Control+minus - Control+KP\_Subtract_. - -*font-reset* - Resets the font size to the default. Default: _Control+0 Control+KP\_0_. - -*spawn-terminal* - Spawns a new terminal. If the shell has been configured to emit - the OSC 7 escape sequence, the new terminal will start in the - current working directory. Default: _Control+Shift+N_. - -*minimize* - Minimizes the window. Default: _not bound_. - -*maximize* - Toggle the maximized state. Default: _not bound_. - -*fullscreen* - Toggles the fullscreen state. Default: _not bound_. - -*pipe-visible*, *pipe-scrollback* - Pipes the currently visible text, or the entire scrollback, to an - external tool. The syntax for this option is a bit special; the - first part of the value is the command to execute enclosed in - "[]", followed by the binding(s). - - You can configure multiple pipes as long as the command strings - are different and the key bindings are unique. - - Note that the command is *not* automatically run inside a shell; - use *sh -c "command line"* if you need that. - - Example: - *pipe-visible=[sh -c "xurls | bemenu | xargs -r firefox"] Control+Print* - - Default: _not bound_ - -# SECTION: mouse-bindings - -This section lets you override the default mouse bindings. - -The general format is _action=BTN\__, where _BTN\__ is -the name of the event code (e.g. *BTN\_LEFT*, *BTN\_RIGHT*). You can -find the event names using *libinput debug-events*. - -A button can only be mapped to *one* action. Lets say you want to bind -*BTN\_MIDDLE* to *fullscreen*. Since *BTN\_MIDDLE* is the default -binding for *primary-paste*, you first need to unmap the default -binding. This can be done by setting _action=none_; -e.g. *primary-paste=none*. - -All actions listed under *key-bindings* can be user here as well. - -*primary-paste* - Pastes from the _primary selection_. Default: _BTN\_MIDDLE_. - - -# FONT FORMAT - -The font is specified in FontConfig syntax. That is, a colon-separated -list of font name and font options. - -_Examples_: -- Dina:weight=bold:slant=italic -- Courier New:size=12 - -# TWEAKS - -This section is for advanced users and describes configuration options -that can be used to tweak foot's low-level behavior. - -These options are *not* included in the example configuration. You -should not change these unless you understand what they do and note -that changing the default values *will* print a warning when launching -foot. - -When reporting bugs, please mention if, and to what, you have changed -any of these options. - -*delayed-render-lower*, *delayed-render-upper* - These two values control the timeouts (in nanoseconds) that are - used to mitigate screen flicker caused by clients writing large, - non-atomic screen updates. - - If a client splits up a screen update over multiple *write*(3) - calls, we may end up rendering an intermediate frame, quickly - followed by another frame with the final screen content. For - example, the client may erase part of the screen (or scroll) in - one write, and then write new content in one or more subsequent - writes. Rendering the frame when the screen has been erased, but - not yet filled with new content will be perceived as screen - flicker. - - The *real* solution to this is _Application Synchronized Updates_ - (https://gitlab.freedesktop.org/terminal-wg/specifications/-/merge_requests/2). - - The problem with this is twofold - first, it has not yet been - standardized, and thus there are not many terminal emulators that - implement it (foot *does* implement it), and second, applications - must be patched to use it. - - Until this has happened, foot offers an interim workaround; an - attempt to mitigate the screen flicker *without* affecting neither - performance nor latency. - - It is based on the fact that the screen is updated at a fixed - interval (typically 60Hz). For us, this means it does not matter - if we render a new frame at the *beginning* of a frame interval, - or at the *end*. Thus, the goal is to introduce a delay between - receiving client data and rendering the resulting state, but - without causing a frame skip. - - While it should be possible to estimate the amount of time left - until the next frame, foot's algorithm is currently not that - advanced, but is based on statistics I guess you could say - the - delay we introduce is so small that the risk of pushing the frame - over to the next frame interval is also very small. - - Now, that was a lof of text. But what is it foot actually does? - - When receiving client data, it schedules a timer, the - *delayed-render-lower*. If we do not receive any more client data - before the timer has run out, we render the frame. If however, we - do receive more data, the timer is re-scheduled. That is, each - time we receive client data, frame rendering is delayed another - *delayed-render-lower* nanoseconds. - - Now, while this works very well with most clients, it would be - possible to construct a malicious client that keeps writing data - at a slow pace. To the user, this would look like foot has frozen - as we never get to render a new frame. To prevent this, an upper - limit is set - *delayed-render-upper*. If this timer runs out, we - render the frame regardless of what the client is doing. - - If changing these values, note that the lower timeout *must* be - set lower than the upper timeout, but that this is not verified by - foot. Furthermore, both values must be less than 16ms (that is, - 16000000 nanoseconds). - - You can disable the feature altoghether by setting either value to - 0. In this case, frames are rendered "as soon as possible". - - Default: lower=_500000_ (0.5ms), upper=_8333333_ (8.3ms - half a - frame interval). - -*max-shm-pool-size-mb* - - This option controls the amount of *virtual* memory used by the - pixmap memory to which the terminal screen content is rendered. - - It does *not* change how much physical memory foot uses. - - Foot uses a memory mapping trick to implement fast rendering of - interactive scrolling (typically, but applies to "slow" scrolling - in general). Example: holding down the 'up' or 'down' arrow key to - scroll in a text editor. - - For this to work, it needs a large amount of virtual address - space. Again, note that this is *not* physical memory. - - On a normal x64 based computer, each process has 128TB of virtual - address space, and newer ones have 64PB. This is an insane amount - and most applications do not use anywhere near that amount. - - Each foot terminal window can allocate up to 2GB of virtual - address space. With 128TB of address space, that means a maximum - of 65536 windows in server/daemon mode (for 2GB). That should be - enough, yes? - - However, the Wayland compositor *also* needs to allocate the same - amount of virtual address space. Thus, it has a slightly higher - chance of running out of address space since it needs to host - *all* running Wayland clients in the same way, at the same time. - - In the off chance that this becomes a problem for you, you can - reduce the amount used with this option. - - Or, for optimal performance, you can increase it to the maximum - allowed value, 2GB (but note that you most likely will not notice - any difference compared to the default value). - - Note: this feature is always disabled in 32-bit. - - Default: _512_. Maximum allowed: _2048_ (2GB). diff --git a/doc/footrc.5.scd b/doc/footrc.5.scd new file mode 100644 index 00000000..97545886 --- /dev/null +++ b/doc/footrc.5.scd @@ -0,0 +1,413 @@ +footrc(5) + +# NAME +footrc - configuration file + +# DESCRIPTION + +*foot* uses the standard _unix configuration format_, with section based +key/value pairs. The default section is unnamed (i.e. not prefixed +with a _[section]_). + +foot will search for a configuration file in the following locations, +in this order: + +- _XDG_CONFIG_HOME/footrc_ +- _~/.config/footrc_ + +# SECTION: default + +*font* + Comma separated list of fonts to use, in fontconfig format (see + *FONT FORMAT*). + + The first font is the primary font. The remaining fonts are + fallback fonts that will be used whenever a glyph cannot be found + in the primary font. + + The fallback fonts are searched in the order they appear. If a + glyph cannot be found in any of the fallback fonts, the dynamic + fallback list from fontconfig (for the primary font) is + searched. + + Default: _monospace_. + +*geometry* + Initial window width and height in pixels (subject to output + scaling), on the form _WIDTHxHEIGHT_. Default: _700x500_. + +*pad* + Padding between border and glyphs, in pixels (subject to output + scaling), on the form _XxY_. Default: _2x2_. + +*initial-window-mode* + Initial window mode for each newly spawned window: *windowed*, + *maximized* or *fullscreen*. Default: _windowed_. + +*shell* + Executable to launch. Typically a shell. Default: _$SHELL_ if set, + otherwise the user's default shell (as specified in + _/etc/passwd_). You can also pass arguments. For example + "/bin/bash --norc". + +*login-shell* + Boolean. If enabled, the shell will be launched as a login shell, + by prepending a '-' to argv[0]. Default: _no_. + +*term* + Value to set the environment variable *TERM* to. Default: _foot_. + +*title* + Initial window title. Default: _foot_. + +*app-id* + Value to set the *app-id* property on the Wayland window to. The + compositor can use this value to e.g. group multiple windows, or + apply window management rules. Default: _foot_. + +*scrollback* + Number of scrollback lines. Default: _1000_. + +*scrollback-indicator-position* + Configures the style of the scrollback position indicator. One of + *none*, *fixed* or *relative*. *none* disables the indicator + completely. *fixed* always renders the indicator near the top at + the window, and *relative* renders the indicator at the position + corresponding to the current scrollback position. Default: + _relative_. + +*scrollback-indicator-format* + Which format to use when displaying the scrollback position + indicator. Either _percentage_ or _line_. This option is ignored + if *scrollback-indicator-position=none*. Default: _percentage_. + +*workers* + Number of threads to use for rendering. Set to 0 to disable + multithreading. Default: the number of available logical CPUs + (including SMT). Note that this is not always the best value. In + some cases, the number of physical _cores_ is better. + + +# SECTION: cursor + +This section controls the cursor style and color. Note that +applications can change these at runtime. + +*style* + Configures the default cursor style, and is one of: _block_, _bar_ + 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 + (cursor) colors for the cursor. Default: inversed foreground and + background colors. Note that this value only applies to the block + cursor. The other cursor styles are always rendered with the + foreground color. + +# SECTION: colors + +This section controls the 16 ANSI colors and the default foreground +and background colors. Note that applications can change these at +runtime. + +The colors are in RRGGBB format. That is, they do *not* have an alpha +component. You can configure the background transparency with the +_alpha_ option. + +*foreground* + Default RRGGBB foreground color. This is the color used when no + ANSI color is being used. Default: _dcdccc_. + +*background* + Default RRGGBB background color. This is the color used when no + ANSI color is being used. Default: _111111_. + +*regular0*, *regular1* *..* *regular7* + The eight basic ANSI colors. Default: _222222_, _cc9393_, + _7f9f7f_, _d0bf8f_, _6ca0a3_, _dc8cc3_, _93e0e3_ and _dcdccc_ (a + variant of the _zenburn_ theme). + +*bright0*, *bright1* *..* *bright7* + The eight bright ANSI colors. Default: _666666_, _dca3a3_, + _bfebbf_, _f0dfaf_, _8cd0d3_, _fcace3_, _b3ffff_ and _ffffff_ (a + variant of the _zenburn_ theme). + +*alpha* + Background translucency. A value in the range 0.0-1.0, where 0.0 + means completely transparent, and 1.0 is opaque. Default: _1.0_. + +# SECTION: csd + +This section controls the look of the _CSDs_ (Client Side +Decorations). Note that the default is to *not* use CSDs, but instead +to use _SSDs_ (Server Side Decorations) when the compositor supports +it. + +Note that unlike the colors defined in the _colors_ section, the color +values here are in AARRGGBB format. I.e. they contain an alpha +component. + +*preferred* + Which type of window decorations to prefer: *client* (CSD) or + *server* (SSD). Note that this is only a hint to the + compositor. Depending on the compositor's configuration and + capabilities, it may not have any effect. Default: _server_. + +*size* + Height, in pixels (subject to output scaling), of the + titlebar. Default: _26_. + +*color* + Titlebar AARRGGBB color. Default: use the default _foreground_ + color. + +*button-width* + Width, in pixels (subject to output scaling), of the + minimize/maximize/close buttons. Default: _26_. + +*button-minimize-color* + Minimize button's AARRGGBB color. Default: use the default + _regular4_ color (blue). + +*button-maximize-color* + Maximize button's AARRGGBB color. Default: use the default + _regular2_ color (green). + +*button-close-color* + Close button's AARRGGBB color. Default: use the default _regular1_ + color (red). + +# SECTION: key-bindings + +This section lets you override the default key bindings. + +The general format is _action=combo1...comboN_. That is, each action +may have one or more key combinations, space separated. Each +combination is on the form _mod1+mod2+key_. The names of the modifiers +and the key *must* be valid XKB key names. + +Note that if *Shift* is one of the modifiers, the _key_ *must* be in +upper case. For example, *Control+Shift+v* will never trigger - +*Control+Shift+V* is the correct way to write it. + +Note that *Alt* is usually called *Mod1*. + +A key combination can only be mapped to *one* action. Lets say you +want to bind *Control+Shift+R* to *fullscreen*. Since this is the +default shortcut for *search-start*, you first need to unmap the +default binding. This can be done by setting _action=none_; +e.g. *search-start=none*. + +*scrollback-up* + Scrolls up/back in history. Default: _Shift+Page\_Up_. + +*scrollback-down* + Scroll down/forward in history. Default: _Shift+Page\_Down_. + +*clipboard-copy* + Copies the current selection into the _clipboard_. Default: _Control+Shift+C_. + +*clipboard-paste* + Pastes from the _clipboard_. Default: _Control+Shift+V_. + +*primary-paste* + Pastes from the _primary selection_. Default: not bound (to a + _key_, see *mouse-bindings*). + +*search-start* + Starts a scrollback/history search. Default: _Control+Shift+R_. + +*font-increase* + Increases the font size by 0.5pt. Default: _Control+plus + Control+equal Control+KP\_Add_. + +*font-decrease* + Decreases the font size by 0.5pt. Default: _Control+minus + Control+KP\_Subtract_. + +*font-reset* + Resets the font size to the default. Default: _Control+0 Control+KP\_0_. + +*spawn-terminal* + Spawns a new terminal. If the shell has been configured to emit + the OSC 7 escape sequence, the new terminal will start in the + current working directory. Default: _Control+Shift+N_. + +*minimize* + Minimizes the window. Default: _not bound_. + +*maximize* + Toggle the maximized state. Default: _not bound_. + +*fullscreen* + Toggles the fullscreen state. Default: _not bound_. + +*pipe-visible*, *pipe-scrollback* + Pipes the currently visible text, or the entire scrollback, to an + external tool. The syntax for this option is a bit special; the + first part of the value is the command to execute enclosed in + "[]", followed by the binding(s). + + You can configure multiple pipes as long as the command strings + are different and the key bindings are unique. + + Note that the command is *not* automatically run inside a shell; + use *sh -c "command line"* if you need that. + + Example: + *pipe-visible=[sh -c "xurls | bemenu | xargs -r firefox"] Control+Print* + + Default: _not bound_ + +# SECTION: mouse-bindings + +This section lets you override the default mouse bindings. + +The general format is _action=BTN\__, where _BTN\__ is +the name of the event code (e.g. *BTN\_LEFT*, *BTN\_RIGHT*). You can +find the event names using *libinput debug-events*. + +A button can only be mapped to *one* action. Lets say you want to bind +*BTN\_MIDDLE* to *fullscreen*. Since *BTN\_MIDDLE* is the default +binding for *primary-paste*, you first need to unmap the default +binding. This can be done by setting _action=none_; +e.g. *primary-paste=none*. + +All actions listed under *key-bindings* can be user here as well. + +*primary-paste* + Pastes from the _primary selection_. Default: _BTN\_MIDDLE_. + + +# FONT FORMAT + +The font is specified in FontConfig syntax. That is, a colon-separated +list of font name and font options. + +_Examples_: +- Dina:weight=bold:slant=italic +- Courier New:size=12 + +# TWEAKS + +This section is for advanced users and describes configuration options +that can be used to tweak foot's low-level behavior. + +These options are *not* included in the example configuration. You +should not change these unless you understand what they do and note +that changing the default values *will* print a warning when launching +foot. + +When reporting bugs, please mention if, and to what, you have changed +any of these options. + +*delayed-render-lower*, *delayed-render-upper* + These two values control the timeouts (in nanoseconds) that are + used to mitigate screen flicker caused by clients writing large, + non-atomic screen updates. + + If a client splits up a screen update over multiple *write*(3) + calls, we may end up rendering an intermediate frame, quickly + followed by another frame with the final screen content. For + example, the client may erase part of the screen (or scroll) in + one write, and then write new content in one or more subsequent + writes. Rendering the frame when the screen has been erased, but + not yet filled with new content will be perceived as screen + flicker. + + The *real* solution to this is _Application Synchronized Updates_ + (https://gitlab.freedesktop.org/terminal-wg/specifications/-/merge_requests/2). + + The problem with this is twofold - first, it has not yet been + standardized, and thus there are not many terminal emulators that + implement it (foot *does* implement it), and second, applications + must be patched to use it. + + Until this has happened, foot offers an interim workaround; an + attempt to mitigate the screen flicker *without* affecting neither + performance nor latency. + + It is based on the fact that the screen is updated at a fixed + interval (typically 60Hz). For us, this means it does not matter + if we render a new frame at the *beginning* of a frame interval, + or at the *end*. Thus, the goal is to introduce a delay between + receiving client data and rendering the resulting state, but + without causing a frame skip. + + While it should be possible to estimate the amount of time left + until the next frame, foot's algorithm is currently not that + advanced, but is based on statistics I guess you could say - the + delay we introduce is so small that the risk of pushing the frame + over to the next frame interval is also very small. + + Now, that was a lof of text. But what is it foot actually does? + + When receiving client data, it schedules a timer, the + *delayed-render-lower*. If we do not receive any more client data + before the timer has run out, we render the frame. If however, we + do receive more data, the timer is re-scheduled. That is, each + time we receive client data, frame rendering is delayed another + *delayed-render-lower* nanoseconds. + + Now, while this works very well with most clients, it would be + possible to construct a malicious client that keeps writing data + at a slow pace. To the user, this would look like foot has frozen + as we never get to render a new frame. To prevent this, an upper + limit is set - *delayed-render-upper*. If this timer runs out, we + render the frame regardless of what the client is doing. + + If changing these values, note that the lower timeout *must* be + set lower than the upper timeout, but that this is not verified by + foot. Furthermore, both values must be less than 16ms (that is, + 16000000 nanoseconds). + + You can disable the feature altoghether by setting either value to + 0. In this case, frames are rendered "as soon as possible". + + Default: lower=_500000_ (0.5ms), upper=_8333333_ (8.3ms - half a + frame interval). + +*max-shm-pool-size-mb* + + This option controls the amount of *virtual* memory used by the + pixmap memory to which the terminal screen content is rendered. + + It does *not* change how much physical memory foot uses. + + Foot uses a memory mapping trick to implement fast rendering of + interactive scrolling (typically, but applies to "slow" scrolling + in general). Example: holding down the 'up' or 'down' arrow key to + scroll in a text editor. + + For this to work, it needs a large amount of virtual address + space. Again, note that this is *not* physical memory. + + On a normal x64 based computer, each process has 128TB of virtual + address space, and newer ones have 64PB. This is an insane amount + and most applications do not use anywhere near that amount. + + Each foot terminal window can allocate up to 2GB of virtual + address space. With 128TB of address space, that means a maximum + of 65536 windows in server/daemon mode (for 2GB). That should be + enough, yes? + + However, the Wayland compositor *also* needs to allocate the same + amount of virtual address space. Thus, it has a slightly higher + chance of running out of address space since it needs to host + *all* running Wayland clients in the same way, at the same time. + + In the off chance that this becomes a problem for you, you can + reduce the amount used with this option. + + Or, for optimal performance, you can increase it to the maximum + allowed value, 2GB (but note that you most likely will not notice + any difference compared to the default value). + + Note: this feature is always disabled in 32-bit. + + Default: _512_. Maximum allowed: _2048_ (2GB). diff --git a/doc/meson.build b/doc/meson.build index 6d3219dc..39697496 100644 --- a/doc/meson.build +++ b/doc/meson.build @@ -3,7 +3,7 @@ sh = find_program('sh', native: true) scdoc = dependency('scdoc', native: true) scdoc_prog = find_program(scdoc.get_pkgconfig_variable('scdoc'), native: true) -foreach man_src : ['foot.1.scd', 'foot.5.scd', 'footclient.1.scd'] +foreach man_src : ['foot.1.scd', 'footrc.5.scd', 'footclient.1.scd'] parts = man_src.split('.') name = parts[-3] section = parts[-2] -- cgit v1.3 From c3f01bda23461df48829e4c9816d96f657170217 Mon Sep 17 00:00:00 2001 From: Daniel Eklöf Date: Mon, 27 Jul 2020 20:06:54 +0200 Subject: doc: footrc.5: add references to foot.1 and footclient.1 --- doc/footrc.5.scd | 4 ++++ 1 file changed, 4 insertions(+) (limited to 'doc') diff --git a/doc/footrc.5.scd b/doc/footrc.5.scd index 97545886..f23d7a36 100644 --- a/doc/footrc.5.scd +++ b/doc/footrc.5.scd @@ -411,3 +411,7 @@ any of these options. Note: this feature is always disabled in 32-bit. Default: _512_. Maximum allowed: _2048_ (2GB). + +# SEE ALSO + +*foot*(1), *footclient*(1) -- cgit v1.3 From 2882fbb537f53feb33d407c3aac103d0189af725 Mon Sep 17 00:00:00 2001 From: Daniel Eklöf Date: Tue, 28 Jul 2020 19:56:53 +0200 Subject: config: add free-form text variant to 'scrollback-indicator-format' And make the empty string the new default. --- config.c | 19 ++++++++++++++----- config.h | 5 ++++- doc/footrc.5.scd | 5 +++-- footrc | 2 +- render.c | 12 +++++++++--- 5 files changed, 31 insertions(+), 12 deletions(-) (limited to 'doc') diff --git a/config.c b/config.c index 8da9c258..19e2a2ca 100644 --- a/config.c +++ b/config.c @@ -314,10 +314,17 @@ parse_section_main(const char *key, const char *value, struct config *conf, conf->scrollback.indicator.format = SCROLLBACK_INDICATOR_FORMAT_LINENO; } else { - LOG_ERR("%s:%d: 'scrollback-indicator-format must be one " - "of 'percent' or 'line'", - path, lineno); - return false; + free(conf->scrollback.indicator.text); + conf->scrollback.indicator.text = NULL; + + size_t len = mbstowcs(NULL, value, -1); + if (len < 0) { + LOG_ERRNO("%s:%d: invalid scrollback-indicator-format value", path, lineno); + return false; + } + + conf->scrollback.indicator.text = calloc(len + 1, sizeof(wchar_t)); + mbstowcs(conf->scrollback.indicator.text, value, len); } } @@ -967,7 +974,8 @@ config_load(struct config *conf, const char *conf_path) .lines = 1000, .indicator = { .position = SCROLLBACK_INDICATOR_POSITION_RELATIVE, - .format = SCROLLBACK_INDICATOR_FORMAT_PERCENTAGE, + .format = SCROLLBACK_INDICATOR_FORMAT_TEXT, + .text = wcsdup(L""), }, }, .colors = { @@ -1119,6 +1127,7 @@ config_free(struct config conf) free(conf.shell); free(conf.title); free(conf.app_id); + free(conf.scrollback.indicator.text); tll_foreach(conf.fonts, it) config_font_destroy(&it->item); tll_free(conf.fonts); diff --git a/config.h b/config.h index eee01e65..9de282a0 100644 --- a/config.h +++ b/config.h @@ -51,8 +51,11 @@ struct config { enum { SCROLLBACK_INDICATOR_FORMAT_PERCENTAGE, - SCROLLBACK_INDICATOR_FORMAT_LINENO + SCROLLBACK_INDICATOR_FORMAT_LINENO, + SCROLLBACK_INDICATOR_FORMAT_TEXT, } format; + + wchar_t *text; } indicator; } scrollback; diff --git a/doc/footrc.5.scd b/doc/footrc.5.scd index f23d7a36..6bba164f 100644 --- a/doc/footrc.5.scd +++ b/doc/footrc.5.scd @@ -78,8 +78,9 @@ in this order: *scrollback-indicator-format* Which format to use when displaying the scrollback position - indicator. Either _percentage_ or _line_. This option is ignored - if *scrollback-indicator-position=none*. Default: _percentage_. + indicator. Either _percentage_, _line_, or a custom fixed + string. This option is ignored if + *scrollback-indicator-position=none*. Default: _empty string_. *workers* Number of threads to use for rendering. Set to 0 to disable diff --git a/footrc b/footrc index 900ce149..30eeee39 100644 --- a/footrc +++ b/footrc @@ -3,7 +3,7 @@ # font=monospace # scrollback=1000 # scrollback-indicator-position=relative -# scrollback-indicator-format=percentage +# scrollback-indicator-format= # geometry=700x500 # pad=2x2 # initial-window-mode=windowed diff --git a/render.c b/render.c index 195839fb..92b546ed 100644 --- a/render.c +++ b/render.c @@ -1358,20 +1358,26 @@ render_scrollback_position(struct terminal *term) ? 1.0 : (double)rebased_view / term->grid->num_rows; - wchar_t text[64]; + wchar_t _text[64]; + const wchar_t *text = _text; int cell_count; /* *What* to render */ switch (term->conf->scrollback.indicator.format) { case SCROLLBACK_INDICATOR_FORMAT_PERCENTAGE: - swprintf(text, sizeof(text) / sizeof(text[0]), L"%u%%", (int)(100 * percent)); + swprintf(_text, sizeof(_text) / sizeof(_text[0]), L"%u%%", (int)(100 * percent)); cell_count = 3; break; case SCROLLBACK_INDICATOR_FORMAT_LINENO: - swprintf(text, sizeof(text) / sizeof(text[0]), L"%d", rebased_view + 1); + swprintf(_text, sizeof(_text) / sizeof(_text[0]), L"%d", rebased_view + 1); cell_count = 1 + (int)log10(term->grid->num_rows); break; + + case SCROLLBACK_INDICATOR_FORMAT_TEXT: + text = term->conf->scrollback.indicator.text; + cell_count = wcslen(text); + break; } const int scale = term->scale; -- cgit v1.3