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
| Selector | Matches |
|---|---|
pointer | Every mouse and touchpad |
touchpad | Touchpads |
mouse | Everything that isn't a touchpad |
name:TEXT | Devices 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
| Field | Effect |
|---|---|
accel_speed | Pointer speed, -1.0–1.0 |
accel_profile | "adaptive", "flat" (constant speed), or "custom" |
accel_curve | Custom motion curve: { step, points } |
scroll_curve | Custom continuous-scroll curve: { step, points } |
natural_scroll | Reverse scrolling |
scroll_factor | Scroll speed, 0.01–10.0 |
left_handed | Swap left and right buttons |
middle_emulation | Click left and right together for a middle click |
tap | Tap to click |
tap_drag | Tap and drag |
tap_drag_lock | Keep 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_typing | Ignore the touchpad while you type |
disable_while_trackpointing | Ignore the touchpad while you use a trackpoint |
scroll_method | "two_finger", "edge", "on_button_down", or "none" |
scroll_button | Button to hold for scrolling |
scroll_button_lock | Click the scroll button once instead of holding it |
enabled | Turn 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 } },
})| Field | Value |
|---|---|
step | Positive, finite sample spacing in device units/ms |
points | 2–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" } })| Field | Effect |
|---|---|
fingers | Number of fingers |
direction | left, right, up, down, horizontal, or vertical |
action | A continuous action below, or a discrete key binding action |
argument | The action's argument |
command | Command for spawn |
mods | Keys 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 })| Field | Default | Effect |
|---|---|---|
swipe_distance | 300 | Distance for a full swipe, 50–2000 |
cancel_ratio | 0.5 | How much of a swipe triggers the action, 0–1 |
min_speed_to_force | 30 | A fast flick triggers even if short, 0–100 |
natural | true | Content follows your fingers |