File: 10-pointer-go-faster.lua

package info (click to toggle)
libinput 1.30.0-1
  • links: PTS, VCS
  • area: main
  • in suites: forky, sid
  • size: 8,404 kB
  • sloc: ansic: 104,881; python: 3,570; sh: 183; makefile: 37; cpp: 7
file content (22 lines) | stat: -rw-r--r-- 721 bytes parent folder | download
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
-- 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)