10-pointer-go-faster.lua 721 B

12345678910111213141516171819202122
  1. -- SPDX-License-Identifier: MIT
  2. --
  3. -- An example plugin to make the pointer go three times as fast
  4. --
  5. -- Install this file in /etc/libinput/plugins and
  6. --
  7. -- UNCOMMENT THIS LINE TO ACTIVATE THE PLUGIN
  8. -- libinput:register({1})
  9. libinput:connect("new-evdev-device", function(device)
  10. local usages = device:usages()
  11. if usages[evdev.REL_X] then
  12. device:connect("evdev-frame", function(device, frame, timestamp)
  13. for _, v in ipairs(frame) do
  14. if v.usage == evdev.REL_X or v.usage == evdev.REL_Y then
  15. -- Multiply the relative motion by 3
  16. v.value = v.value * 3
  17. end
  18. end
  19. return frame
  20. end)
  21. end
  22. end)