Skip to content

armgit / cua

Public Imported from GitHub
0

Scale computer-use 2.0 with open-source drivers, cross-OS sandboxes, and benchmarks for training, evaluation, and data generation.

Merge branch 'main' into feat/add-desktop-commands

Dillon DuPontf0da8a129eec
diff --cc docs/content/docs/computer-sdk/commands.mdx
index 96330f396c,f1eb75ce49..c7b5a39b50
--- a/docs/content/docs/computer-sdk/commands.mdx
+++ b/docs/content/docs/computer-sdk/commands.mdx
@@@ -13,70 -13,23 +13,80 @@@ Execute shell commands and get detaile
<Tabs items={['Python', 'TypeScript']}>
<Tab value="Python">
- ```python # Run shell command result = await computer.interface.run_command(cmd) #
- result.stdout, result.stderr, result.returncode ```
+
+ ```python
+ # Run shell command
+ result = await computer.interface.run_command(cmd) # result.stdout, result.stderr, result.returncode
+ ```
-
++
</Tab>
<Tab value="TypeScript">
- ```typescript // Run shell command const result = await computer.interface.runCommand(cmd); //
- result.stdout, result.stderr, result.returncode ```
+
+ ```typescript
+ // Run shell command
+ const result = await computer.interface.runCommand(cmd); // result.stdout, result.stderr, result.returncode
+ ```
+
</Tab>
</Tabs>
+## Window Management
+
+Control application launching and windows:
+
+<Tabs items={['Python', 'TypeScript']}>
+ <Tab value="Python">
++
+ ```python
+ # Launch applications
+ await computer.interface.launch("xfce4-terminal")
+ await computer.interface.launch("libreoffice --writer")
+ await computer.interface.open("https://www.google.com")
+
+ # Window management
+ windows = await computer.interface.get_application_windows("xfce4-terminal")
+ window_id = windows[0]
+ await computer.interface.activate_window(window_id)
+
+ window_id = await computer.interface.get_current_window_id() # get the current active window id
+ await computer.interface.window_size(window_id)
+ await computer.interface.get_window_title(window_id)
+ await computer.interface.get_window_position(window_id)
+ await computer.interface.set_window_size(window_id, 1200, 800)
+ await computer.interface.set_window_position(window_id, 100, 100)
+ await computer.interface.maximize_window(window_id)
+ await computer.interface.minimize_window(window_id)
+ await computer.interface.close_window(window_id)
+ ```
+
+ </Tab>
+ <Tab value="TypeScript">
++
+ ```typescript
+ // Launch applications
+ await computer.interface.launch("xfce4-terminal");
+ await computer.interface.launch("libreoffice --writer");
+ await computer.interface.open("https://www.google.com");
+
+ // Window management
+ const windows = await computer.interface.getApplicationWindows("xfce4-terminal");
+ let windowId = windows[0];
+ await computer.interface.activateWindow(windowId);
+
+ windowId = await computer.interface.getCurrentWindowId(); // current active window id
+ await computer.interface.getWindowSize(windowId);
+ await computer.interface.getWindowName(windowId);
+ await computer.interface.getWindowPosition(windowId);
+ await computer.interface.setWindowSize(windowId, 1200, 800);
+ await computer.interface.setWindowPosition(windowId, 100, 100);
+ await computer.interface.maximizeWindow(windowId);
+ await computer.interface.minimizeWindow(windowId);
+ await computer.interface.closeWindow(windowId);
+ ```
+
+ </Tab>
+</Tabs>
+
## Mouse Actions
Precise mouse control and interaction: