Module: lib-tde.mouse

This module exposes an api to manipulate mouse events through libinput

Useful functional for setting mouse acceleration, natural scrolling, mouse speed and more

Info:

  • Copyright: 2020 Tom Meyers
  • Author: Tom Meyers

Static module functions

lib-tde.mouse.getInputDevices () -> table Returns a table of all mouse input devices ranging from trackpads, to mouses to trackpoints
lib-tde.mouse.setAcceleration (id, speed) Set the acceleration of a specific input device through xinput
lib-tde.mouse.setMouseSpeed (id, speed) Set the acceleration of a specific input device through xinput
lib-tde.mouse.setNaturalScrolling (id, bIsNaturalScrolling) Enable/Disable natural scrolling for the mouse


Static module functions

lib-tde.mouse.getInputDevices () -> table
Returns a table of all mouse input devices ranging from trackpads, to mouses to trackpoints

Returns:

    table The table containing a field with the id and canonical name

Usage:

    -- Returns for example {{"id": 11, "name": "HID-compliant Mouse Trust Gaming Mouse"}}
       local devices = getInputDevices()
       print("The first device is called: " .. devices[1].name .. " and has ID: " .. devices[1].id)
lib-tde.mouse.setAcceleration (id, speed)
Set the acceleration of a specific input device through xinput

Parameters:

  • id number the identifier of the mouse @see getInputDevices
  • speed number The acceleration speed of the mouse, 1.0 means no acceleration and anything above indicates faster speed than default as a multiplier

Usage:

    -- Make the "HID-compliant Mouse Trust Gaming Mouse" accelerate by twice its normal speed
        setAcceleration(11, 2)
lib-tde.mouse.setMouseSpeed (id, speed)
Set the acceleration of a specific input device through xinput

Parameters:

  • id number the identifier of the mouse @see getInputDevices
  • speed number The default speed of the mouse, 1.0 means standard libinput speed anything larger is faster, anything smaller is slower (minimum speed is 0.01)

Usage:

    -- Make the "HID-compliant Mouse Trust Gaming Mouse" twice as slow as the default speed
        setMouseSpeed(11, 0.5)
lib-tde.mouse.setNaturalScrolling (id, bIsNaturalScrolling)
Enable/Disable natural scrolling for the mouse

Parameters:

  • id number the identifier of the mouse @see getInputDevices
  • bIsNaturalScrolling number Enable or Disable natural scrolling for the mouse

Usage:

    -- Enable natural scrolling speed for "HID-compliant Mouse Trust Gaming Mouse"
        setNaturalScrolling(11, true)
generated by LDoc 1.4.6 Build with 💜 By F0xedb Last updated 2021-05-21 03:30:15