> ## Documentation Index
> Fetch the complete documentation index at: https://docs.run.cloud/llms.txt
> Use this file to discover all available pages before exploring further.

# Browser desktops

> Open and control a Linux desktop inside a sandbox

The `runcloud/desktop` image gives a sandbox a graphical Linux desktop that you
can open in a browser or control from an agent.

## Open a desktop

Create the sandbox and keep its ID:

```bash theme={null}
SANDBOX_ID=$(runcloud sandbox create \
  --image runcloud/desktop \
  --json | jq -r '.id')
```

Open the desktop in your default browser:

```bash theme={null}
runcloud sandbox desktop "$SANDBOX_ID"
```

To embed or open the desktop yourself, print its signed noVNC URL:

```bash theme={null}
runcloud sandbox desktop "$SANDBOX_ID" --url
```

Desktop URLs are temporary bearer credentials. Keep them out of logs, issue
trackers, and public chat.

## View-only access

Use a view-only desktop when someone or something should observe the screen
without sending keyboard or pointer input:

```bash theme={null}
runcloud sandbox desktop "$SANDBOX_ID" --view-only
```

Combine `--view-only` with `--url` to print the corresponding signed URL.

## Control the desktop from an agent

Capture the current screen:

```bash theme={null}
runcloud sandbox screenshot "$SANDBOX_ID" --output screen.png
```

Send pointer and keyboard input:

```bash theme={null}
runcloud sandbox click "$SANDBOX_ID" 420 300
runcloud sandbox type "$SANDBOX_ID" "hello world"
runcloud sandbox key "$SANDBOX_ID" "ctrl+l"
```

Coordinates are measured in pixels from the top-left corner. `key` accepts
xdotool-style key names and chords such as `Return`, `ctrl+l`, or `alt+F4`.

Destroy the sandbox when the job is finished:

```bash theme={null}
runcloud sandbox rm "$SANDBOX_ID"
```
