libinput/plugins/10-pointer-go-faster.lua
Peter Hutterer d6e1f93812 plugins: update plugins for the current API
A few changes to the Lua API didn't get reflected in the example
plugins, let's update them.

Also included here is naming of all arguments, instead of _ use the
argument name even where unused. These are examples so being expressive
is more important than making any lua static checkers happy.

Part-of: <https://gitlab.freedesktop.org/libinput/libinput/-/merge_requests/1339>
2025-10-23 13:28:16 +00:00

22 lines
721 B
Lua

-- SPDX-License-Identifier: MIT
--
-- An example plugin to make the pointer go three times as fast
--
-- Install this file in /etc/libinput/plugins and
--
-- UNCOMMENT THIS LINE TO ACTIVATE THE PLUGIN
-- libinput:register({1})
libinput:connect("new-evdev-device", function(device)
local usages = device:usages()
if usages[evdev.REL_X] then
device:connect("evdev-frame", function(device, frame, timestamp)
for _, v in ipairs(frame) do
if v.usage == evdev.REL_X or v.usage == evdev.REL_Y then
-- Multiply the relative motion by 3
v.value = v.value * 3
end
end
return frame
end)
end
end)