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

# Display Management

> Configure sandbox display resolution and settings for desktop environments in HopX sandboxes. Set display resolution, configure display settings, and manage multiple displays for desktop automation and GUI testing. Learn how to configure displays using Python and JavaScript SDKs or REST API. Includes examples for display configuration.

Configure display resolution and settings for the desktop environment.

## Overview

Display management enables:

* Getting current display resolution
* Setting display resolution
* Listing available resolutions
* Configuring display settings

<Note>
  Desktop automation requires a template with desktop support. Ensure your sandbox has desktop capabilities enabled.
</Note>

## Getting Display Information

Get current display resolution and settings:

<Tabs>
  <Tab title="Python">
    ```python theme={null}
    from hopx_ai import Sandbox

    sandbox = Sandbox.create(template="desktop")

    # Get display info
    display = sandbox.desktop.get_display()

    print(f"Resolution: {display.width}x{display.height}")
    print(f"Color depth: {display.depth} bits")
    ```
  </Tab>

  <Tab title="JavaScript">
    ```javascript theme={null}
    import { Sandbox } from '@hopx-ai/sdk';

    const sandbox = await Sandbox.create({ template: 'desktop' });

    // Get display info
    const display = await sandbox.desktop.getDisplayInfo();

    console.log(`Resolution: ${display.width}x${display.height}`);
    console.log(`Color depth: ${display.depth} bits`);
    ```
  </Tab>
</Tabs>

## Setting Resolution

Set display resolution:

<Tabs>
  <Tab title="Python">
    ```python theme={null}
    # Set resolution to 1920x1080
    display = sandbox.desktop.set_resolution(1920, 1080)

    print(f"New resolution: {display.width}x{display.height}")

    # Set to 1280x720
    display = sandbox.desktop.set_resolution(1280, 720)
    print(f"Resolution: {display.width}x{display.height}")
    ```
  </Tab>

  <Tab title="JavaScript">
    ```javascript theme={null}
    // Set resolution to 1920x1080
    await sandbox.desktop.setResolution(1920, 1080);

    // Verify
    const display = await sandbox.desktop.getDisplayInfo();
    console.log(`Resolution: ${display.width}x${display.height}`);

    // Set to 1280x720
    await sandbox.desktop.setResolution(1280, 720);
    ```
  </Tab>
</Tabs>

## Available Resolutions

List available display resolutions:

<Tabs>
  <Tab title="Python">
    ```python theme={null}
    # Get available resolutions
    resolutions = sandbox.desktop.get_available_resolutions()

    print("Available resolutions:")
    for width, height in resolutions:
        print(f"  {width}x{height}")

    # Find highest resolution
    if resolutions:
        highest = max(resolutions, key=lambda r: r[0] * r[1])
        print(f"Highest: {highest[0]}x{highest[1]}")
    ```
  </Tab>

  <Tab title="JavaScript">
    ```javascript theme={null}
    // Get available resolutions
    const resolutions = await sandbox.desktop.getAvailableResolutions();

    console.log('Available resolutions:');
    resolutions.forEach(([width, height]) => {
      console.log(`  ${width}x${height}`);
    });

    // Find highest resolution
    if (resolutions.length > 0) {
      const highest = resolutions.reduce((a, b) => 
        (a[0] * a[1] > b[0] * b[1]) ? a : b
      );
      console.log(`Highest: ${highest[0]}x${highest[1]}`);
    }
    ```
  </Tab>
</Tabs>

## Common Resolutions

Common display resolutions:

* **1920x1080**: Full HD (1080p) - Recommended
* **1280x720**: HD (720p)
* **2560x1440**: 2K (1440p)
* **3840x2160**: 4K (2160p)

## Complete Example

Complete display management workflow:

<Tabs>
  <Tab title="Python">
    ```python theme={null}
    from hopx_ai import Sandbox

    sandbox = Sandbox.create(template="desktop")

    try:
        # Get current display
        current = sandbox.desktop.get_display()
        print(f"Current: {current.width}x{current.height}")
        
        # List available resolutions
        resolutions = sandbox.desktop.get_available_resolutions()
        print(f"Available: {len(resolutions)} resolutions")
        
        # Set to Full HD
        display = sandbox.desktop.set_resolution(1920, 1080)
        print(f"Set to: {display.width}x{display.height}")
        
        # Verify
        verify = sandbox.desktop.get_display()
        assert verify.width == 1920 and verify.height == 1080
        print("✅ Resolution verified")
        
    finally:
        sandbox.kill()
    ```
  </Tab>

  <Tab title="JavaScript">
    ```javascript theme={null}
    import { Sandbox } from '@hopx-ai/sdk';

    const sandbox = await Sandbox.create({ template: 'desktop' });

    try {
      // Get current display
      const current = await sandbox.desktop.getDisplayInfo();
      console.log(`Current: ${current.width}x${current.height}`);
      
      // List available resolutions
      const resolutions = await sandbox.desktop.getAvailableResolutions();
      console.log(`Available: ${resolutions.length} resolutions`);
      
      // Set to Full HD
      await sandbox.desktop.setResolution(1920, 1080);
      
      // Verify
      const verify = await sandbox.desktop.getDisplayInfo();
      if (verify.width === 1920 && verify.height === 1080) {
        console.log('✅ Resolution verified');
      }
      
    } finally {
      await sandbox.kill();
    }
    ```
  </Tab>
</Tabs>

## Resolution Best Practices

<Tip>
  Set display resolution before starting VNC server for optimal remote desktop experience.
</Tip>

* **Before VNC**: Set resolution before starting VNC for best results
* **Standard sizes**: Use common resolutions (1920x1080, 1280x720) for compatibility
* **Testing**: Test different resolutions for your use case

## Related

* [VNC Server](/core-concepts/desktop/vnc-server) - Remote desktop access
* [CLI Reference](/cli/introduction) - Command-line interface for HopX
* [Window Management](/core-concepts/desktop/window-management) - Manage windows
* **SDK**: [sandbox.desktop.get\_display()](/sdk/python/desktop#get_display) - Python SDK method

## Next Steps

* Learn about [VNC Server](/core-concepts/desktop/vnc-server) for remote desktop access
* Explore [Window Management](/core-concepts/desktop/window-management) to manage windows
* Review [Screenshots](/core-concepts/desktop/screenshots) for visual verification
