From bcea929c94cc8f8da8f29e52c17b09824a252318 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Daniel=20Ekl=C3=B6f?= Date: Sun, 24 Oct 2021 11:49:37 +0200 Subject: [PATCH] config: add [key-bindings].noop action Key combinations assigned to this action will not be sent to the application. Closes #765 --- CHANGELOG.md | 5 ++++- config.c | 1 + doc/foot.ini.5.scd | 12 ++++++++---- foot.ini | 1 + input.c | 3 +++ wayland.h | 1 + 6 files changed, 18 insertions(+), 5 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index b1526a04..ff51423a 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -38,8 +38,11 @@ * `notify-focus-inhibit` boolean option, which can be used to control whether desktop notifications should be inhibited when the terminal has keyboard focus -* `colors.scrollback-indicator` color-pair option, which specifies +* `[colors].scrollback-indicator` color-pair option, which specifies foreground and background colors for the scrollback indicator. +* `[key-bindings].noop` action. Key combinations assigned to this + action will not be sent to the application + (https://codeberg.org/dnkl/foot/issues/765). ### Changed diff --git a/config.c b/config.c index 8be36fea..bd9ebbf2 100644 --- a/config.c +++ b/config.c @@ -84,6 +84,7 @@ static const uint32_t default_color_table[256] = { static const char *const binding_action_map[] = { [BIND_ACTION_NONE] = NULL, + [BIND_ACTION_NOOP] = "noop", [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", diff --git a/doc/foot.ini.5.scd b/doc/foot.ini.5.scd index 7a8ce173..0eba49dd 100644 --- a/doc/foot.ini.5.scd +++ b/doc/foot.ini.5.scd @@ -606,24 +606,28 @@ 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*. +*noop* + All key combinations listed here will not be sent to the + application. Default: _not bound_. + *scrollback-up-page* Scrolls up/back one page in history. Default: _Shift+Page\_Up_. *scrollback-up-half-page* - Scrolls up/back half of a page in history. Default: _not set_. + Scrolls up/back half of a page in history. Default: _not bound_. *scrollback-up-line* - Scrolls up/back a single line in history. Default: _not set_. + Scrolls up/back a single line in history. Default: _not bound_. *scrollback-down-page* Scroll down/forward one page in history. Default: _Shift+Page\_Down_. *scrollback-down-half-page* - Scroll down/forward half of a page in history. Default: _not set_. + Scroll down/forward half of a page in history. Default: _not bound_. *scrollback-down-line* - Scroll down/forward a single line in history. Default: _not set_. + Scroll down/forward a single line in history. Default: _not bound_. *clipboard-copy* Copies the current selection into the _clipboard_. Default: _Control+Shift+c_. diff --git a/foot.ini b/foot.ini index 131d970d..b37aa383 100644 --- a/foot.ini +++ b/foot.ini @@ -127,6 +127,7 @@ # pipe-selected=[xargs -r firefox] none # show-urls-launch=Control+Shift+u # show-urls-copy=none +# noop=none [search-bindings] # cancel=Control+g Control+c Escape diff --git a/input.c b/input.c index 7ffdd91f..19ec2cfa 100644 --- a/input.c +++ b/input.c @@ -87,6 +87,9 @@ execute_binding(struct seat *seat, struct terminal *term, case BIND_ACTION_NONE: return true; + case BIND_ACTION_NOOP: + return true; + case BIND_ACTION_SCROLLBACK_UP_PAGE: if (term->grid == &term->normal) { cmd_scrollback_up(term, term->rows); diff --git a/wayland.h b/wayland.h index 4881c6c5..b92f622d 100644 --- a/wayland.h +++ b/wayland.h @@ -30,6 +30,7 @@ struct terminal; enum bind_action_normal { BIND_ACTION_NONE, + BIND_ACTION_NOOP, BIND_ACTION_SCROLLBACK_UP_PAGE, BIND_ACTION_SCROLLBACK_UP_HALF_PAGE, BIND_ACTION_SCROLLBACK_UP_LINE,