Skip to content

feat: add screenshot command and a live device grid to the app - #76

Open
hakanngul wants to merge 1 commit into
MobAI-App:mainfrom
hakanngul:feat/live-device-grid
Open

hakanngul wants to merge 1 commit into
MobAI-App:mainfrom
hakanngul:feat/live-device-grid

Conversation

@hakanngul

Copy link
Copy Markdown

Summary

Adds a way to see what each simulator is showing, from both the CLI and the macOS app.

CLI: simslim screenshot <udid> [path]

  • Captures a booted simulator's screen as a PNG via simctl io screenshot, to path or a temp file. --json returns {udid, name, path} (ScreenshotOutput in output.go).
  • Resolves the exact UDID first, as boot and shutdown do, so an alias like all never reaches the capture path. A shut-down simulator gets a clear error.
  • Handles multi-display devices. On a device with more than one display (for example an iPad presenting an external display), simctl refuses to choose and lists the displays. CaptureScreenshot parses that list and retries against the display marked (primary). I hit this on an iPad simulator during manual testing.

App: Table / Grid toggle

  • A segmented control in the toolbar switches the detail pane between the existing table and a grid of cards.
  • Each card shows the simulator's live screen, refreshed every 4 s while the grid is visible, with at most 4 captures in flight. It also shows name, runtime, boot state, and slim state, with tap-to-select and a context menu for boot, shutdown, slim, unslim, and rename.
  • Shut-down simulators show a placeholder. Images for simulators that are no longer booted are dropped.
  • The app still talks to the CLI only through --json. There is no new IPC.

Testing

On top of current main (v0.15.0):

  • go test ./..., go vet ./..., gofmt -l .: clean
  • swift-format lint --strict --recursive gui: clean
  • zsh -n scripts/build-app.sh, plutil -lint gui/Info.plist, make app: pass
  • Manual: booted iPhone 17 and iPad simulators (iOS 27.2). screenshot --json wrote valid PNGs, and the multi-display retry produced the primary screen. In the app's grid, a booted device's preview appeared after boot and kept refreshing.

I did not add unit tests. If you want them, CaptureScreenshot and primaryDisplayID can be covered with the existing fake-xcrun PATH pattern from simctl_test.go.

🤖 Generated with Claude Code

Add `simslim screenshot <udid> [path]`, which captures a booted
simulator's screen as a PNG via `simctl io screenshot` and, under
--json, reports the written path. Like boot and shutdown it resolves
the exact UDID first, so an alias such as "all" never reaches the
capture path.

A device with more than one display (for example an iPad presenting an
external display) makes simctl refuse to choose and list the displays.
CaptureScreenshot parses that listing and retries against the display
marked "(primary)".

The macOS app gains a Table/Grid toggle in the toolbar. The grid shows
each simulator as a card with its live screen, refreshed every few
seconds while the grid is visible (at most four captures at a time),
plus boot and slim state, tap-to-select, and a context menu for boot,
shutdown, slim, unslim, and rename. Shut-down simulators show a
placeholder.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant