10-logitech-mx-master-horiz-scroll.lua 1.1 KB

1234567891011121314151617181920212223242526272829303132
  1. -- SPDX-License-Identifier: MIT
  2. --
  3. -- This plugin inverts the horizontal scroll direction of
  4. -- the Logitech MX Master mouse. OOTB the mouse scrolls
  5. -- in the opposite direction to all other mice out there.
  6. --
  7. -- This plugin is only needed when the mouse is connected
  8. -- to the Logitech Bolt receiver - on that receiver we cannot
  9. -- tell which device is connected.
  10. --
  11. -- For the Logitech Unifying receiver and Bluetooth please
  12. -- add the ModelInvertHorizontalScrolling=1 quirk
  13. -- in quirks/30-vendor-logitech.quirks.
  14. --
  15. --
  16. -- Install this file in /etc/libinput/plugins and
  17. --
  18. -- UNCOMMENT THIS LINE TO ACTIVATE THE PLUGIN
  19. -- libinput:register({1})
  20. libinput:connect("new-evdev-device", function (device)
  21. local info = device:info()
  22. if info.vid == 0x046D and info.pid == 0xC548 then
  23. device:connect("evdev-frame", function (device, frame, timestamp)
  24. for _, event in ipairs(frame) do
  25. if event.usage == evdev.REL_HWHEEL or event.usage == evdev.REL_HWHEEL_HI_RES then
  26. event.value = -event.value
  27. end
  28. end
  29. return frame
  30. end)
  31. end
  32. end)