From e7c56b0b29f19592fbb5f9e28abf49f9301eedf1 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Daniel=20Ekl=C3=B6f?= Date: Tue, 8 Dec 2020 19:49:14 +0100 Subject: [PATCH 1/5] completions: zsh: foot: fix default path of foot.ini --- completions/zsh/_foot | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/completions/zsh/_foot b/completions/zsh/_foot index cfcd9533..24ddd671 100644 --- a/completions/zsh/_foot +++ b/completions/zsh/_foot @@ -2,7 +2,7 @@ _arguments \ -s -S -C \ - '(-c --config)'{-c,--config}'[path to configuration file (XDG_CONFIG_HOME/footrc)]:config:_files' \ + '(-c --config)'{-c,--config}'[path to configuration file (XDG_CONFIG_HOME/foot/foot.ini)]:config:_files' \ '(-C --check-config)'{-C,--check-config}'[verify configuration and exit with 0 if ok, otherwise exit with 1]' \ '(-f --font)'{-f,--font}'[font name and style in fontconfig format (monospace)]:font:->fonts' \ '(-t --term)'{-t,--term}'[value to set the environment variable TERM to (foot)]:term:->terms' \ From 7b16802972ec93db3c584488b89b1c40f31d5d27 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Daniel=20Ekl=C3=B6f?= Date: Tue, 8 Dec 2020 19:49:43 +0100 Subject: [PATCH 2/5] config: remove support for loading configuration from footrc --- CHANGELOG.md | 4 ++++ config.c | 24 ------------------------ doc/foot.ini.5.scd | 2 -- 3 files changed, 4 insertions(+), 26 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index ac69ddd3..1d78e588 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -98,6 +98,10 @@ means foot can be PGO:d in e.g. sandboxed build scripts. See ### Deprecated ### Removed + +* Support for loading configuration from `$XDG_CONFIG_HOME/footrc`. + + ### Fixed * Error when re-assigning a default key binding diff --git a/config.c b/config.c index b37d1a25..1cfaafb2 100644 --- a/config.c +++ b/config.c @@ -272,7 +272,6 @@ static struct config_file open_config(struct config *conf) { struct config_file ret = {.path = NULL, .fd = -1}; - bool log_deprecation = false; path_components_t components = tll_init(); @@ -311,12 +310,6 @@ open_config(struct config *conf) } } - /* Next try footrc */ - if (tll_length(components) > 0 && try_open_file(&components, "footrc")) { - log_deprecation = true; - goto done; - } - /* Finally, try foot/foot.ini in all XDG_CONFIG_DIRS */ const char *xdg_config_dirs = getenv("XDG_CONFIG_DIRS"); xdg_config_dirs_copy = xdg_config_dirs != NULL @@ -357,23 +350,6 @@ out: done: assert(tll_length(components) > 0); ret = path_components_to_config_file(&components); - - if (log_deprecation && ret.path != NULL) { - LOG_WARN("deprecated: configuration in $XDG_CONFIG_HOME/footrc, " - "use $XDG_CONFIG_HOME/foot/foot.ini instead"); - - char *text = xstrdup( - "configuration in \033[31m$XDG_CONFIG_HOME/footrc\033[39m or " - "\033[31m~/.config/footrc\033[39m, " - "use \033[32m$XDG_CONFIG_HOME/foot/foot.ini\033[39m or " - "\033[32m~/.config/foot/foot.ini\033[39m instead"); - - struct user_notification deprecation = { - .kind = USER_NOTIFICATION_DEPRECATED, - .text = text, - }; - tll_push_back(conf->notifications, deprecation); - } goto out; } diff --git a/doc/foot.ini.5.scd b/doc/foot.ini.5.scd index 24632f8f..14cd6d16 100644 --- a/doc/foot.ini.5.scd +++ b/doc/foot.ini.5.scd @@ -14,8 +14,6 @@ in this order: - *XDG_CONFIG_HOME/foot/foot.ini* - *~/.config/foot/foot.ini* -- *XDG_CONFIG_HOME/footrc* -- *~/.config/footrc* - *XDG_CONFIG_DIRS/foot/foot.ini* # SECTION: default From 6ec63eae009a23ab31fc81f0e17e28e1fe7f4ee8 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Daniel=20Ekl=C3=B6f?= Date: Tue, 8 Dec 2020 19:52:28 +0100 Subject: [PATCH 3/5] config: remove support for default.scrollback --- CHANGELOG.md | 1 + config.c | 22 ---------------------- 2 files changed, 1 insertion(+), 22 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 1d78e588..96d1c57e 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -100,6 +100,7 @@ means foot can be PGO:d in e.g. sandboxed build scripts. See ### Removed * Support for loading configuration from `$XDG_CONFIG_HOME/footrc`. +* **scrollback** option from `foot.ini`. ### Fixed diff --git a/config.c b/config.c index 1cfaafb2..b24aae48 100644 --- a/config.c +++ b/config.c @@ -583,28 +583,6 @@ parse_section_main(const char *key, const char *value, struct config *conf, mbstowcs(conf->word_delimiters, value, chars + 1); } - else if (strcmp(key, "scrollback") == 0) { - LOG_WARN("deprecated: %s:%d: [default]: scrollback: use 'scrollback.lines' instead'", path, lineno); - - const char fmt[] = "%s:%d: \033[1mdefault.scrollback\033[21m, use \033[1mscrollback.lines\033[21m instead"; - char *text = xasprintf(fmt, path, lineno); - - struct user_notification deprecation = { - .kind = USER_NOTIFICATION_DEPRECATED, - .text = text, - }; - tll_push_back(conf->notifications, deprecation); - - unsigned long lines; - if (!str_to_ulong(value, 10, &lines)) { - LOG_AND_NOTIFY_ERR( - "%s:%d: [default]: scrollback: expected an integer, got '%s'", - path, lineno, value); - return false; - } - conf->scrollback.lines = lines; - } - else { LOG_AND_NOTIFY_ERR("%s:%u: [default]: %s: invalid key", path, lineno, key); return false; From 386796cec69089b0acb70c5f10f6b049a30aad52 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Daniel=20Ekl=C3=B6f?= Date: Tue, 8 Dec 2020 19:53:36 +0100 Subject: [PATCH 4/5] config: remove support for default.geometry --- CHANGELOG.md | 1 + config.c | 17 +---------------- 2 files changed, 2 insertions(+), 16 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 96d1c57e..22bd560e 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -101,6 +101,7 @@ means foot can be PGO:d in e.g. sandboxed build scripts. See * Support for loading configuration from `$XDG_CONFIG_HOME/footrc`. * **scrollback** option from `foot.ini`. +* **geometry** option from `foot.ini`. ### Fixed diff --git a/config.c b/config.c index b24aae48..a3f4e674 100644 --- a/config.c +++ b/config.c @@ -436,22 +436,7 @@ parse_section_main(const char *key, const char *value, struct config *conf, conf->app_id = xstrdup(value); } - else if (strcmp(key, "initial-window-size-pixels") == 0 || - strcmp(key, "geometry") == 0 /* deprecated */) - { - if (strcmp(key, "geometry") == 0) { - LOG_WARN("deprecated: %s:%d: [default]: geometry: use 'initial-window-size-pixels' instead'", path, lineno); - - const char fmt[] = "%s:%d: \033[1mgeometry\033[21m, use \033[1minitial-window-size-pixels\033[21m instead"; - char *text = xasprintf(fmt, path, lineno); - - struct user_notification deprecation = { - .kind = USER_NOTIFICATION_DEPRECATED, - .text = text, - }; - tll_push_back(conf->notifications, deprecation); - } - + else if (strcmp(key, "initial-window-size-pixels") == 0) { unsigned width, height; if (sscanf(value, "%ux%u", &width, &height) != 2 || width == 0 || height == 0) { LOG_AND_NOTIFY_ERR( From 5020366bf59f47d36d4a2d33ac9501f401dfaf5c Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Daniel=20Ekl=C3=B6f?= Date: Tue, 8 Dec 2020 19:58:02 +0100 Subject: [PATCH 5/5] config: remove support for scrollback-up and scrollback-down --- CHANGELOG.md | 1 + config.c | 49 ++----------------------------------------------- input.c | 2 -- wayland.h | 2 -- 4 files changed, 3 insertions(+), 51 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 22bd560e..b4240bee 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -102,6 +102,7 @@ means foot can be PGO:d in e.g. sandboxed build scripts. See * Support for loading configuration from `$XDG_CONFIG_HOME/footrc`. * **scrollback** option from `foot.ini`. * **geometry** option from `foot.ini`. +* Key binding action **scrollback-up** and **scrollback-down**. ### Fixed diff --git a/config.c b/config.c index a3f4e674..e28937a9 100644 --- a/config.c +++ b/config.c @@ -55,11 +55,9 @@ static const uint32_t default_bright[] = { static const char *const binding_action_map[] = { [BIND_ACTION_NONE] = NULL, - [BIND_ACTION_SCROLLBACK_UP] = "scrollback-up", [BIND_ACTION_SCROLLBACK_UP_PAGE] = "scrollback-up-page", [BIND_ACTION_SCROLLBACK_UP_HALF_PAGE] = "scrollback-up-half-page", [BIND_ACTION_SCROLLBACK_UP_LINE] = "scrollback-up-line", - [BIND_ACTION_SCROLLBACK_DOWN] = "scrollback-down", [BIND_ACTION_SCROLLBACK_DOWN_PAGE] = "scrollback-down-page", [BIND_ACTION_SCROLLBACK_DOWN_HALF_PAGE] = "scrollback-down-half-page", [BIND_ACTION_SCROLLBACK_DOWN_LINE] = "scrollback-down-line", @@ -1051,43 +1049,6 @@ argv_compare(char *const *argv1, char *const *argv2) return 1; } -static void -maybe_deprecated_key_binding(struct config *conf, - const char *section, - enum bind_action_normal action, - const char *path, unsigned lineno) -{ - enum bind_action_normal replacement = BIND_ACTION_NONE; - - switch (action) { - case BIND_ACTION_SCROLLBACK_UP: - replacement = BIND_ACTION_SCROLLBACK_UP_PAGE; - break; - - case BIND_ACTION_SCROLLBACK_DOWN: - replacement = BIND_ACTION_SCROLLBACK_DOWN_PAGE; - break; - - default: - return; - } - - LOG_WARN("deprecated: %s:%d: [%s]: key binding %s, use %s instead", - path, lineno, section, - binding_action_map[action], binding_action_map[replacement]); - - const char fmt[] = "%s:%d: [%s]: \033[1m%s\033[21m, use \033[1m%s\033[21m instead"; - char *text = xasprintf( - fmt, path, lineno, section, - binding_action_map[action], binding_action_map[replacement]); - - struct user_notification deprecation = { - .kind = USER_NOTIFICATION_DEPRECATED, - .text = text, - }; - tll_push_back(conf->notifications, deprecation); -} - /* * Parses a key binding value on the form * "[cmd-to-exec arg1 arg2] Mods+Key" @@ -1171,9 +1132,6 @@ parse_section_key_bindings( if (strcmp(key, binding_action_map[action]) != 0) continue; - maybe_deprecated_key_binding( - conf, "key-bindings", action, path, lineno); - /* Unset binding */ if (strcasecmp(value, "none") == 0) { tll_foreach(conf->bindings.key, it) { @@ -1465,9 +1423,6 @@ parse_section_mouse_bindings( if (strcmp(key, binding_action_map[action]) != 0) continue; - maybe_deprecated_key_binding( - conf, "mouse-bindings", action, path, lineno); - /* Unset binding */ if (strcasecmp(value, "none") == 0) { tll_foreach(conf->bindings.mouse, it) { @@ -1859,8 +1814,8 @@ add_default_key_bindings(struct config *conf) const struct config_key_modifiers ctrl = {.ctrl = true}; const struct config_key_modifiers ctrl_shift = {.ctrl = true, .shift = true}; - add_binding(BIND_ACTION_SCROLLBACK_UP, shift, XKB_KEY_Page_Up); - add_binding(BIND_ACTION_SCROLLBACK_DOWN, shift, XKB_KEY_Page_Down); + add_binding(BIND_ACTION_SCROLLBACK_UP_PAGE, shift, XKB_KEY_Page_Up); + add_binding(BIND_ACTION_SCROLLBACK_DOWN_PAGE, shift, XKB_KEY_Page_Down); add_binding(BIND_ACTION_CLIPBOARD_COPY, ctrl_shift, XKB_KEY_C); add_binding(BIND_ACTION_CLIPBOARD_PASTE, ctrl_shift, XKB_KEY_V); add_binding(BIND_ACTION_PRIMARY_PASTE, shift, XKB_KEY_Insert); diff --git a/input.c b/input.c index 31c1d816..41e3e750 100644 --- a/input.c +++ b/input.c @@ -87,7 +87,6 @@ execute_binding(struct seat *seat, struct terminal *term, case BIND_ACTION_NONE: return true; - case BIND_ACTION_SCROLLBACK_UP: case BIND_ACTION_SCROLLBACK_UP_PAGE: cmd_scrollback_up(term, term->rows); return true; @@ -100,7 +99,6 @@ execute_binding(struct seat *seat, struct terminal *term, cmd_scrollback_up(term, 1); return true; - case BIND_ACTION_SCROLLBACK_DOWN: case BIND_ACTION_SCROLLBACK_DOWN_PAGE: cmd_scrollback_down(term, term->rows); return true; diff --git a/wayland.h b/wayland.h index faee928e..ffc9f1a9 100644 --- a/wayland.h +++ b/wayland.h @@ -26,11 +26,9 @@ typedef tll(struct key_binding) key_binding_list_t; enum bind_action_normal { BIND_ACTION_NONE, - BIND_ACTION_SCROLLBACK_UP, /* Deprecated, alias for UP_PAGE */ BIND_ACTION_SCROLLBACK_UP_PAGE, BIND_ACTION_SCROLLBACK_UP_HALF_PAGE, BIND_ACTION_SCROLLBACK_UP_LINE, - BIND_ACTION_SCROLLBACK_DOWN, /* Deprecated, alias for DOWN_PAGE */ BIND_ACTION_SCROLLBACK_DOWN_PAGE, BIND_ACTION_SCROLLBACK_DOWN_HALF_PAGE, BIND_ACTION_SCROLLBACK_DOWN_LINE,