Syntax
Description
Performs a mouse drag operation from a source to a destination. Supports element refs, absolute coordinates, or mixed combinations.Parameters
Source element reference (e.g.,
@e1). Drags from element center.Source coordinates in format
x,y (e.g., 100,200).Destination element reference (e.g.,
@e5). Drags to element center.Destination coordinates in format
x,y (e.g., 400,200).Drag duration in milliseconds. Controls how fast the drag animation executes.
You must provide either
--from or --from-xy for the source, and either --to or --to-xy for the destination.Examples
Drag between elements
Drag from element to coordinates
Drag with exact coordinates
Drag with custom duration
Use Cases
- Reorder items in lists or trees
- Move files between folders in Finder
- Drag-and-drop UI elements in design tools
- Resize windows or split panes by dragging dividers
- Select text by dragging (use coordinates for precision)
Related Commands
- hover - Position cursor before dragging
- mouse-down - Press mouse button
- mouse-up - Release mouse button
- mouse-move - Move cursor during manual drag