From fe7aa25ad82f5551f0a84bb98df8ccbac39a8f79 Mon Sep 17 00:00:00 2001 From: Daniel Eklöf Date: Mon, 18 Sep 2023 16:36:39 +0200 Subject: input: make wheel events mappable Un-grabbed wheel events are now passed through the mouse binding matching logic, instead of being hardcoded to scrolling the terminal contents. They are mappable through the BTN_BACK and BTN_FORWARD buttons. Since they're not actually button *presses*, they never generate a click count other than 1. This limitation is documented, but not checked in the config. This means it's possible to create bindings like "BTN_BACK+3" (i.e. triple "click"). They will however never trigger. The old, hardcoded logic is now accessible through the new scrollback-up-mouse and scrollback-down-mouse mouse bindings. They (obiously) default to BTN_BACK and BTN_FORWARD, respectively. Example usage: keep the default of scrolling terminal contents with the wheel, when used without modifiers, but map Control+wheel to font zoom in/out: [mouse-bindings] font-increase=Control+BTN_FORWARD font-decrease=Control+BTN_BACK (this also keeps the default key bindings to zoom in/out; ctrl-+ and ctrl+-) Closes #1077 --- doc/foot.ini.5.scd | 27 ++++++++++++++++++++++++--- 1 file changed, 24 insertions(+), 3 deletions(-) (limited to 'doc') diff --git a/doc/foot.ini.5.scd b/doc/foot.ini.5.scd index 8726da0c..085dd82f 100644 --- a/doc/foot.ini.5.scd +++ b/doc/foot.ini.5.scd @@ -1032,9 +1032,14 @@ of the modifiers *must* be valid XKB key names, and the button name *must* be a valid libinput name. You can find the button names using *libinput debug-events*. -The trailing *COUNT* is optional and specifies the click count -required to trigger the binding. The default if *COUNT* is omitted is -_1_. +The trailing *COUNT* (number of times the button has to be clicked) is +optional and specifies the click count required to trigger the +binding. The default if *COUNT* is omitted is _1_. + +To map wheel events (i.e. scrolling), use the button names *BTN_BACK* +(up) and *BTN_FORWARD* (down). Note that these events never generate a +*COUNT* larger than 1. That is, *BTN_BACK+2*, for example, will never +trigger. A modifier+button combination can only be mapped to *one* action. Lets say you want to bind *BTN\_MIDDLE* to *fullscreen*. Since @@ -1056,6 +1061,22 @@ _action=none_; e.g. *primary-paste=none*. The actions to which mouse combos can be bound are listed below. All actions listed under *key-bindings* can be used here as well. +*scrollback-up-mouse* + Normal screen: scrolls up the contents. + + Alt screen: send fake _KeyUP_ events to the client application, if + alternate scroll mode is enabled. + + Default: _BTN_BACK_ + +*scrollback-down-mouse* + Normal screen: scrolls down the contents. + + Alt screen: send fake _KeyDOWN_ events to the client application, if + alternate scroll mode is enabled. + + Default: _BTN_FORWARD_ + *select-begin* Begin an interactive selection. The selection is finalized, and copied to the _primary selection_, when the button is -- cgit v1.3