MCPcopy Create free account
hub / github.com/callstack/agent-device / swipeLinux

Function swipeLinux

src/platforms/linux/input-actions.ts:147–174  ·  view source on GitHub ↗
(
  x1: number,
  y1: number,
  x2: number,
  y2: number,
  durationMs = 300,
)

Source from the content-addressed store, hash-verified

145// ── Swipe / scroll ──────────────────────────────────────────────────────
146
147export async function swipeLinux(
148 x1: number,
149 y1: number,
150 x2: number,
151 y2: number,
152 durationMs = 300,
153): Promise<void> {
154 const provider = resolveLinuxInputProvider();
155 if (provider) {
156 await provider.drag(x1, y1, x2, y2, durationMs);
157 return;
158 }
159
160 const { tool } = await ensureInputTool();
161 await moveTo(x1, y1);
162 if (tool === 'xdotool') {
163 await xdotool('mousedown', '1');
164 await xdotool('mousemove', '--sync', String(x2), String(y2));
165 await sleep(durationMs);
166 await xdotool('mouseup', '1');
167 } else {
168 // ydotool v1: use click --down / --up for drag
169 await ydotool('click', '--down', '0xC0');
170 await ydotool('mousemove', '--absolute', '-x', String(x2), '-y', String(y2));
171 await sleep(durationMs);
172 await ydotool('click', '--up', '0xC0');
173 }
174}
175
176const DEFAULT_SCROLL_CLICKS = 5;
177

Callers 1

createLinuxInteractorFunction · 0.90

Calls 6

ensureInputToolFunction · 0.90
sleepFunction · 0.90
moveToFunction · 0.85
xdotoolFunction · 0.85
ydotoolFunction · 0.85

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…