Sweets

Input

Touchpad, mouse, and trackball settings, plus touchpad gestures

sweets.input sets up mice, touchpads, and trackballs. Without a selector it applies to every device.

sweets.input({ accel_speed = 0.0 })

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

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

For keyboards, see Input Devices.

Selectors

SelectorMatches
pointerEvery mouse and touchpad
touchpadTouchpads
mouseEverything that isn't a touchpad
name:TEXTDevices whose name contains TEXT

Find device names with sweets msg inputs. To identify one by using it, run sweets msg identify-input, then move that device. This requires a native Sweets session. Press Ctrl+C to stop.

Options

FieldEffect
accel_speedPointer speed, -1.0–1.0
accel_profile"adaptive", "flat" (constant speed), or "custom"
accel_curveCustom motion curve: { step, points }
scroll_curveCustom continuous-scroll curve: { step, points }
natural_scrollReverse scrolling
scroll_factorScroll speed, 0.01–10.0
left_handedSwap left and right buttons
middle_emulationClick left and right together for a middle click
tapTap to click
tap_dragTap and drag
tap_drag_lockKeep dragging after lifting your finger briefly
tap_button_map"lrm": two fingers right-click. "lmr": two fingers middle-click
click_method"button_areas" or "clickfinger"
disable_while_typingIgnore the touchpad while you type
disable_while_trackpointingIgnore the touchpad while you use a trackpoint
scroll_method"two_finger", "edge", "on_button_down", or "none"
scroll_buttonButton to hold for scrolling
scroll_button_lockClick the scroll button once instead of holding it
enabledTurn the device off

Anything you don't set keeps the device's default. Options a device doesn't support are skipped. A mouse block can't use touchpad-only options like tap.

Custom acceleration

Set accel_profile = "custom" in the same block as the curves:

sweets.input("mouse", {
  accel_profile = "custom",
  accel_curve = { step = 1.0, points = { 0, 1, 2.5, 4.5, 7 } },
  scroll_curve = { step = 0.1, points = { 0, 0.015, 0.04, 0.075, 0.12 } },
})
FieldValue
stepPositive, finite sample spacing in device units/ms
points2–64 finite, non-negative speed samples

accel_speed is ignored. scroll_curve affects continuous scrolling, not wheel detents. Remove a curve to restore its default.

Inspect applied settings with sweets msg input ID.

Scroll speed

sweets.input("mouse", { scroll_factor = 0.5 })

-- Slow down only sideways scrolling.
sweets.input("touchpad", { scroll_factor = { horizontal = 0.4 } })

Use a window rule to set scroll speed for one app.

Trackballs

Hold a button and move the ball to scroll:

sweets.input("name:Trackball", {
  scroll_method = "on_button_down",
  scroll_button = "BTN_SIDE",
})

Turning a device off

sweets.input("name:SynPS/2 Synaptics TouchPad", { enabled = false })

-- Only while a mouse is plugged in.
sweets.input("touchpad", { enabled = "disabled_on_external_mouse" })

Toggle a device from the keyboard:

sweets.bind("XF86TouchpadToggle", "toggle_input", "touchpad")

enabled = false without a selector turns off every mouse and touchpad. Your keyboard still works, so you can fix the config and reload.

Touchpad swipe gestures

sweets.gesture({ fingers = 3, direction = "horizontal", action = "workspace" })
sweets.gesture({ fingers = 3, direction = "vertical", action = "overview" })
sweets.gesture({ fingers = 4, direction = "up", action = "special_toggle" })
sweets.gesture({ fingers = 4, direction = "down", action = "spawn", command = { "fuzzel" } })
FieldEffect
fingersNumber of fingers
directionleft, right, up, down, horizontal, or vertical
actionA continuous action below, or a discrete key binding action
argumentThe action's argument
commandCommand for spawn
modsKeys to hold, like "MOD+Shift"

workspace, scroll_strip, and overview follow your fingers. Other actions run once. scroll_strip scrolls the scrolling layout. overview drives the Overview zoom with vertical, up, or down. With natural = true, up opens and down closes; false reverses those directions. Direct movement works with animations off too.

Tune swipes with sweets.gestures:

sweets.gestures({ swipe_distance = 300, natural = true })
FieldDefaultEffect
swipe_distance300Distance for a full swipe, 50–2000
cancel_ratio0.5How much of a swipe triggers the action, 0–1
min_speed_to_force30A fast flick triggers even if short, 0–100
naturaltrueContent follows your fingers

On this page