libinput/doc/user
Peter Hutterer 9e37bc0cfa plugins: add support for lua plugins to change evdev event streams
This patch adds support for Lua scripts to modify evdev devices and
event frames before libinput sees those events.

Plugins in Lua are sandboxed and restricted in what they can do: no IO,
no network, not much of anything else.

A plugin is notified about a new device before libinput handles it and
it can thus modify that device (changes are passed through to our libevdev
context). A plugin can then also connect an evdev frame handler which
gives it access to the evdev frames before libinput processes them. The
example plugin included shows how to swap left/right mouse buttons:

    libinput:register({1})

    function frame(device, frame)
        for _, v in ipairs(frame.events) do
            if v.usage == evdev.BTN_RIGHT then
                v.usage = evdev.BTN_LEFT
            elseif v.usage == evdev.BTN_LEFT then
                v.usage = evdev.BTN_RIGHT
            end
        end
        return frame
    end

    function device_new(plugin, device)
        local usages = device:usages()
        if usages[evdev.BTN_LEFT] and usages[evdev.BTN_RIGHT] then
            device:connect("evdev-frame", frame)
        end
    end

    libinput:connect("new-evdev-device", device_new)

A few other example plugins are included in this patch

Part-of: <https://gitlab.freedesktop.org/libinput/libinput/-/merge_requests/1192>
2025-08-01 16:04:09 +10:00
..
dot doc/user: some rewording and improvements 2018-07-31 16:16:16 +10:00
svg Add an API for configurable eraser button behavior 2025-06-18 19:38:14 +10:00
404.rst doc/user: add custom 404 pages for the old links 2018-08-03 11:18:14 +10:00
absolute-axes.rst doc/user: correct some small typos 2018-08-19 11:54:52 -05:00
absolute-coordinate-ranges.rst doc/user: fix a link to the system hwdb file 2021-04-29 10:30:49 +10:00
architecture.rst doc/user: update architecture docs with the plugin pipeline 2025-06-27 04:11:40 +00:00
building.rst meson: Use the meson setup command 2023-09-03 17:01:59 +00:00
button-debouncing.rst doc/user: rename filenames with underscores to dashes 2018-08-02 11:22:11 +10:00
clickpad-softbuttons.rst touchpad: add clickfinger button map 2024-04-09 19:08:17 -03:00
clickpad-with-right-button.rst Fix pre-commit errors 2024-09-03 09:51:41 +02:00
conf.py.in doc/user: fix sphinx warning 2023-01-17 12:29:25 +10:00
configuration.rst touchpad: implement support for three-finger drag 2025-02-18 06:44:01 +00:00
contributing.rst doc/user: Document "Closes" and "Fixes" tags 2024-02-28 16:59:58 +01:00
dependencies.rst doc/user: generate the required package list for the CI distributions 2021-02-15 15:22:42 +10:00
development.rst High-resolution scroll wheel support 2021-08-31 08:45:01 +02:00
device-configuration-via-udev.rst doc/user: update the udev rule to handle bind/unbind events (part 2) 2023-09-28 08:57:15 +10:00
device-quirks.rst doc/user: device quirk matches have to be 0x prefixed 2025-06-16 06:39:25 +00:00
drag-3fg.rst touchpad: implement support for three-finger drag 2025-02-18 06:44:01 +00:00
faqs.rst doc/user: add FAQ about scroll speed 2023-11-07 09:50:29 +01:00
features.rst touchpad: implement support for three-finger drag 2025-02-18 06:44:01 +00:00
gestures.rst doc/user: move the hold gesture section up to the others 2021-07-27 05:20:45 +00:00
git_version.py.in doc/user: add a hack to get to the git version 2018-08-02 11:22:11 +10:00
ignoring-devices.rst doc/user: update the udev rule to handle bind/unbind events 2023-06-15 03:31:30 +00:00
incorrectly-enabled-hires.rst quirks: allow overriding of AttrEventCode and AttrInputProp 2022-11-28 08:25:41 +10:00
index.rst plugins: add support for lua plugins to change evdev event streams 2025-08-01 16:04:09 +10:00
lua-plugins.rst plugins: add support for lua plugins to change evdev event streams 2025-08-01 16:04:09 +10:00
meson.build plugins: add support for lua plugins to change evdev event streams 2025-08-01 16:04:09 +10:00
middle-button-emulation.rst dox: switch to sphinx for the user-visible documentation 2018-07-30 12:24:04 +10:00
normalization-of-relative-motion.rst doc/user: explain why we are doing motion normalization 2021-03-16 21:29:56 +00:00
palm-detection.rst doc/user: fix tap in palm exclusion zone 2023-03-17 12:23:59 +01:00
pointer-acceleration.rst doc/user: fix a typo 2024-07-19 10:07:49 +10:00
reporting-bugs.rst doc: correct the documentation for reporting trackpoint bugs 2022-02-11 07:45:40 +00:00
scrolling.rst doc/user: add a section on natural scrolling 2023-04-18 16:54:57 +10:00
seats.rst dox: switch to sphinx for the user-visible documentation 2018-07-30 12:24:04 +10:00
switches.rst treewide: fix typos 2020-12-16 22:08:23 +01:00
t440-support.rst doc/user: more fixes including adding a device-types section 2018-08-02 11:22:11 +10:00
tablet-debugging.rst doc/user: fix broken link to systemd 60-evdev.hwdb 2021-10-30 12:10:10 +02:00
tablet-support.rst Add an API for configurable eraser button behavior 2025-06-18 19:38:14 +10:00
tapping.rst doc/user: link to the explanation why we can't change the tap default 2025-01-07 09:10:50 +00:00
test-suite.rst doc: correct that the test suite is indeed run in the CI 2024-10-16 18:03:03 +10:00
timestamps.rst doc/user/timestamps: document which clock is used 2023-05-09 11:18:23 +02:00
tools.rst doc/user: document the new list-kernel-devices tool 2022-12-09 13:16:38 +10:00
touchpad-jitter.rst doc/user: fix typo 2018-10-03 11:13:58 +10:00
touchpad-jumping-cursors.rst touchpad: ignore the ALPS jump to 4095/0 2020-09-07 02:13:40 +00:00
touchpad-pressure-debugging.rst Add examples with other thresholds to the documentation 2024-12-16 11:17:22 +10:00
touchpad-pressure.rst Fix pre-commit errors 2024-09-03 09:51:41 +02:00
touchpad-thumb-detection.rst doc/user: add documentation for the new thumb detection 2019-07-17 09:33:14 +10:00
touchpads.rst doc/user: mark the touchpads page as orphan 2018-08-03 11:18:14 +10:00
trackpoint-configuration.rst Fix pre-commit errors 2024-09-03 09:51:41 +02:00
trackpoints.rst Fix pre-commit errors 2024-09-03 09:51:41 +02:00
troubleshooting.rst doc/user: move ignoring devices to separate page 2023-06-12 13:50:25 +00:00
what-is-libinput.rst doc/user: more fixes including adding a device-types section 2018-08-02 11:22:11 +10:00
wheel-api.rst High-resolution scroll wheel support 2021-08-31 08:45:01 +02:00