wails icon indicating copy to clipboard operation
wails copied to clipboard

Add screen position information to Screen / ScreenGetAll

Open adnsv opened this issue 11 months ago • 2 comments

Is your feature request related to a problem? Please describe.

Currently, runtime.ScreenGetAll() provides information about screen size but lacks screen position data, which is crucial for proper window positioning in multi-monitor setups. This makes it difficult to reliably position windows on specific monitors.

Describe the solution you'd like

Add position fields to the Screen struct.

The information to populate those is already available internally on supported platforms in `internal/frontend/desktop/*/screen.go:

  • Windows: all info is readily available: inside EnumProc(), see lprcMonitor
  • macOS: inside GetNthScreen: you can get values from NSScreen frame
  • Linux: inside GetNThMonitor: use x and y fields in GdkRectangle geometry

Describe alternatives you've considered

No response

Additional context

Use Case:

When restoring window position in multi-monitor setups, we need to:

  1. Know where each screen is located in the virtual desktop space
  2. Validate if saved window coordinates are within valid screen bounds
  3. Ensure windows are restored to the correct monitor
  4. Handle cases where the previous monitor setup is no longer available

adnsv avatar Dec 13 '24 06:12 adnsv