Sweets
Configuration

Input

Configure libinput pointer devices globally or per-device — sweets.input.

sweets.input(...) configures physical libinput pointer devices. On startup, hot reload, and for newly connected devices, Sweets resets configurable fields to libinput defaults, applies the global input block, then applies matching selector blocks in config order.

sweets.input({
  accel_speed = 0.0,
})

sweets.input("touchpad", {
  tap = true,
  natural_scroll = true,
  disable_while_typing = true,
})

sweets.input("mouse", {
  natural_scroll = false,
  accel_profile = "flat",
})

sweets.input("name:ELAN", {
  accel_speed = -0.25,
})

Selectors

Call sweets.input({ ... }) with no selector to target every device, or sweets.input(selector, { ... }) to target a subset:

SelectorMatches
pointerAny physical libinput pointer device
touchpadTapping-capable pointer devices, normally laptop touchpads and trackpads
mousePointer devices that are not detected as touchpads
name:TEXTCase-insensitive device-name substring

Use sweetctl inputs to list connected input devices and pointer types. Use sweetctl input TEXT to inspect one device's supported / current / default libinput settings.

For example, this keeps natural scrolling only on the touchpad while the USB mouse keeps normal wheel direction:

sweets.input({
  accel_speed = 0.0,
})

sweets.input("touchpad", { natural_scroll = true })
sweets.input("mouse", { natural_scroll = false })

Live tuning

Use sweetctl input TEXT to inspect one unique device, then tune a setting without reloading the configuration:

sweetctl input ELAN accel_speed -0.25
sweetctl input ELAN natural_scroll true
sweetctl input "Logitech USB Optical Mouse" accel_profile flat

The supported setting names and values are the same as the options below. These changes are temporary: saving or reloading Lua, reconnecting the device, or restarting Sweets resets it to the configured/default state. Once a value feels right, add it to the matching sweets.input(...) block.

Options

KeyTypeDefaultDescription
tapboollibinputEnable tap-to-click when the device supports tapping
tap_dragboollibinputEnable tap-and-drag
tap_drag_lockboollibinputEnable libinput tap-drag-lock
natural_scrollboollibinputReverse scroll direction for natural scrolling
left_handedboollibinputSwap left/right button behavior where supported
middle_emulationboollibinputEmulate middle click from left+right buttons where supported
disable_while_typingboollibinputDisable touchpad pointer motion while typing where supported
accel_speednumberlibinputPointer acceleration speed, -1.0 to 1.0
accel_profilestringlibinputAcceleration profile: adaptive or flat

These settings are skipped for virtual pointers and non-libinput nested devices. Unsupported settings are ignored for that specific device, so the same block can be used across a mouse, touchpad, and trackpoint without breaking the session.

On this page