( x1: number, y1: number, x2: number, y2: number, durationMs = 300, )
| 145 | // ── Swipe / scroll ────────────────────────────────────────────────────── |
| 146 | |
| 147 | export 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 | |
| 176 | const DEFAULT_SCROLL_CLICKS = 5; |
| 177 |
no test coverage detected
searching dependent graphs…