MCPcopy Index your code
hub / github.com/callstack/agent-device / createLinuxInteractor

Function createLinuxInteractor

src/core/interactors/linux.ts:24–77  ·  view source on GitHub ↗
()

Source from the content-addressed store, hash-verified

22import type { Interactor } from '../interactor-types.ts';
23
24export function createLinuxInteractor(): Interactor {
25 return {
26 open: (app) => openLinuxApp(app),
27 openDevice: () => Promise.resolve(),
28 close: (app) => closeLinuxApp(app),
29 tap: (x, y) => pressLinux(x, y),
30 doubleTap: (x, y) => doubleClickLinux(x, y),
31 swipe: (x1, y1, x2, y2, durationMs) => swipeLinux(x1, y1, x2, y2, durationMs),
32 pan: (x1, y1, x2, y2, durationMs) => swipeLinux(x1, y1, x2, y2, durationMs),
33 fling: () => {
34 throw new AppError('UNSUPPORTED_OPERATION', 'gesture fling not supported on Linux');
35 },
36 longPress: (x, y, durationMs) => longPressLinux(x, y, durationMs),
37 focus: (x, y) => focusLinux(x, y),
38 type: (text, delayMs) => typeLinux(text, delayMs),
39 fill: (x, y, text, delayMs) => fillLinux(x, y, text, delayMs),
40 scroll: (direction, options) => scrollLinux(direction, options),
41 pinch: () => {
42 throw new AppError('UNSUPPORTED_OPERATION', 'gesture pinch not supported on Linux');
43 },
44 screenshot: (outPath, options) => screenshotLinux(outPath, options),
45 snapshot: async (options) => {
46 const result = await withDiagnosticTimer(
47 'snapshot_capture',
48 async () => await snapshotLinux(options?.surface),
49 { backend: 'linux-atspi' },
50 );
51 return {
52 nodes: result.nodes ?? [],
53 truncated: result.truncated ?? false,
54 backend: 'linux-atspi',
55 };
56 },
57 back: () => backLinux(),
58 home: () => homeLinux(),
59 rotate: () => {
60 throw new AppError('UNSUPPORTED_OPERATION', 'rotate not supported on Linux');
61 },
62 rotateGesture: () => {
63 throw new AppError('UNSUPPORTED_OPERATION', 'gesture rotate not supported on Linux');
64 },
65 transformGesture: () => {
66 throw new AppError('UNSUPPORTED_OPERATION', 'gesture transform not supported on Linux');
67 },
68 appSwitcher: () => {
69 throw new AppError('UNSUPPORTED_OPERATION', 'appSwitcher not yet supported on Linux');
70 },
71 readClipboard: () => readLinuxClipboard(),
72 writeClipboard: (text) => writeLinuxClipboard(text),
73 setSetting: () => {
74 throw new AppError('UNSUPPORTED_OPERATION', 'setSetting not supported on Linux');
75 },
76 };
77}

Callers 1

Calls 15

openLinuxAppFunction · 0.90
closeLinuxAppFunction · 0.90
pressLinuxFunction · 0.90
doubleClickLinuxFunction · 0.90
swipeLinuxFunction · 0.90
longPressLinuxFunction · 0.90
focusLinuxFunction · 0.90
typeLinuxFunction · 0.90
fillLinuxFunction · 0.90
scrollLinuxFunction · 0.90
screenshotLinuxFunction · 0.90
withDiagnosticTimerFunction · 0.90

Tested by

no test coverage detected