Input
Configure libinput pointer devices globally or per device
sweets.input configures physical pointer devices. Call it without a selector
for every device, or with one to target a subset.
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,
click_method = "clickfinger",
tap_button_map = "lmr",
scroll_factor = { horizontal = 0.4, vertical = 0.6 },
})Settings are applied in order: libinput defaults, then the global block, then each matching selector block as declared. This happens at startup, on reload, and when a device connects.
Selectors
| Selector | Matches |
|---|---|
pointer | Any physical pointer device |
touchpad | Tapping-capable pointers, normally laptop touchpads |
mouse | Pointers that are not touchpads |
name:TEXT | Case-insensitive substring of the device name |
Options
| Field | Type | Default | Description |
|---|---|---|---|
enabled | boolean or string | true | false stops the device sending any input; "disabled_on_external_mouse" stops it only while a mouse is plugged in |
tap | boolean | libinput | Tap to click |
tap_drag | boolean | libinput | Tap and drag |
tap_drag_lock | boolean | libinput | Tap-drag lock |
tap_button_map | string | libinput | Two- and three-finger tap: "lrm" is right, middle; "lmr" is middle, right |
click_method | string | libinput | "button_areas" or "clickfinger" (clickpads) |
natural_scroll | boolean | libinput | Reverse scroll direction |
scroll_method | string | libinput | "two_finger", "edge", "on_button_down" or "none" |
scroll_button | string | libinput | Button held for on_button_down, such as "BTN_MIDDLE" |
scroll_button_lock | boolean | libinput | Click the scroll button once to start scrolling, again to stop |
scroll_factor | number or table | 1.0 | Scroll speed multiplier, 0.01 to 10.0, for both axes or per axis |
left_handed | boolean | libinput | Swap left and right buttons |
middle_emulation | boolean | libinput | Middle click from left+right |
disable_while_typing | boolean | libinput | Ignore the touchpad while typing |
disable_while_trackpointing | boolean | libinput | Ignore the touchpad while a trackpoint moves |
accel_speed | number | libinput | Pointer acceleration, -1.0 to 1.0 |
accel_profile | string | libinput | "adaptive" or "flat" |
scroll_button accepts BTN_LEFT, BTN_RIGHT, BTN_MIDDLE, BTN_SIDE,
BTN_EXTRA, BTN_FORWARD, BTN_BACK and BTN_TASK.
Unsupported options are ignored per device, so one block can cover a mouse, a touchpad, and a trackpoint. Virtual and nested devices are skipped.
The mouse selector never matches a touchpad, so it rejects touchpad-only
options: the tap options, click_method, disable_while_trackpointing, and
the two_finger and edge scroll methods.
Trackballs and trackpoints
These devices have no wheel. Hold a button and move the ball to scroll:
sweets.input("name:Trackball", {
scroll_method = "on_button_down",
scroll_button = "BTN_SIDE",
scroll_button_lock = true,
})With scroll_button_lock, you click the button once instead of holding it.
Scroll speed
scroll_factor scales how far applications scroll. It does not change
scroll bindings: one wheel notch still
fires a binding once.
A number scales both axes. A table scales the axes it names and leaves the other one alone, which is useful when a touchpad scrolls sideways too fast:
sweets.input("touchpad", {
scroll_factor = { horizontal = 0.4 },
})Turning a device off
sweets.input("name:SynPS/2 Synaptics TouchPad", { enabled = false })The device still appears in sweets msg inputs, so a reload with the block
removed turns it back on.
To turn the touchpad off only while a mouse is plugged in:
sweets.input("touchpad", { enabled = "disabled_on_external_mouse" })libinput offers this mode on built-in touchpads. A device without it stays
enabled and lists enabled in unsupported_settings.
To turn a device off and on from the keyboard, bind toggle_input to an input
selector:
sweets.bind("XF86TouchpadToggle", "toggle_input", "touchpad")A second press restores the configured value, and so does any reload.
Touchpad swipe gestures
Bind a physical touchpad swipe with sweets.gesture:
sweets.gesture({ fingers = 3, direction = "horizontal", action = "workspace" })
sweets.gesture({ fingers = 3, direction = "vertical", action = "scroll_strip" })
sweets.gesture({ fingers = 4, direction = "up", action = "special_toggle" })
sweets.gesture({ fingers = 4, direction = "down", action = "spawn", command = { "fuzzel" } })workspace previews an adjacent numbered workspace one-to-one, then commits
or returns at release. scroll_strip moves a scrolling layout with the fingers.
Other key-binding actions are discrete: they run once when the swipe crosses
the cancel ratio. move_window and resize_window are excluded because they
require a pointer button grab. Use argument for an action argument; spawn
also accepts command. Optional mods = "MOD+Shift" restricts a declaration.
Direction can be left, right, up, down, horizontal, or vertical.
After 16 units of movement it locks for the rest of the sequence. An exact
direction takes precedence over an axis-wide declaration. An unmatched swipe
is forwarded completely to the focused application.
sweets.gestures({
swipe_distance = 300,
cancel_ratio = 0.5,
min_speed_to_force = 30,
natural = true,
})| Field | Range | Default | Meaning |
|---|---|---|---|
swipe_distance | 50–2000 | 300 | Travel that reaches full progress |
cancel_ratio | 0–1 | 0.5 | Progress that commits or fires |
min_speed_to_force | 0–100 | 30 | Release speed in units/ms that commits below the ratio |
natural | boolean | true | Left/up advances; strip content follows the fingers |
Reloads affect the next swipe, not one already in progress. A swipe beginning during session lock, a pointer grab, shortcut inhibition, or a visible special workspace is never acted on. Compositor-owned swipes stay on their start output.
enabled = false in the global block or under pointer turns off every
mouse and touchpad. Your keyboard still works, so you can fix the file and
reload.
Listing devices
sweets msg inputs # every device, with its settings
sweets msg input INPUT_ID # one deviceUse these to find the exact name for a name: selector, and to check which
settings a device actually supports.