hl.gesture

hl.gesture(spec)

Register or remove a trackpad gesture.

Signature

hl.gesture(spec: HL.GestureSpec): nil

Parameters

specHL.GestureSpec

Gesture definition table.

Required fields

fingersinteger

Number of fingers. Must be between 2 and 9.

directionstring

Gesture direction string. Parsed by Hyprland’s gesture manager.

actionstring or function

Gesture action name or Lua callback function.

Accepted actions

workspace

Workspace swipe gesture.

resize

Resize gesture.

move

Move gesture.

special

Special workspace gesture. Uses workspace_name if provided.

close

Close gesture.

float

Float gesture. Uses mode if provided.

fullscreen

Fullscreen gesture. Uses mode if provided.

cursor_zoom or cursorZoom

Cursor zoom gesture. Uses zoom_level and mode if provided.

scroll_move

Scroll-move gesture.

unset

Remove a matching gesture.

Optional fields

modsstring, optional

Modifier string parsed as a Hyprland modifier mask.

scalenumber, optional

Gesture delta scale. Must be between 0.1 and 10. Defaults to 1.

modestring, optional

Action-specific mode string.

zoom_levelstring, optional

Action-specific zoom level string.

workspace_namestring, optional

Workspace name used by the special action.

disable_inhibitboolean, optional

Disable inhibition handling for this gesture.

Returns

nil

This function registers or removes the gesture and does not return a value.

Examples

hl.gesture({
    fingers = 3,
    direction = "horizontal",
    action = "workspace",
})

hl.gesture({
    fingers = 4,
    direction = "down",
    action = "special",
    workspace_name = "scratch",
})

Lua callback action:

hl.gesture({
    fingers = 3,
    direction = "up",
    action = function()
        print("gesture")
    end,
})

See also

HL.GestureSpec

Gesture table accepted by this function.