|
| 1 | +--- |
| 2 | +name: screenshot |
| 3 | +description: Take a screenshot of an iPlug2 standalone app's GUI for iteration with AI |
| 4 | +--- |
| 5 | + |
| 6 | +# Screenshot iPlug2 App GUI |
| 7 | + |
| 8 | +Use this skill to capture a screenshot of a running iPlug2 standalone app. This is useful for iterating on GUI design with AI assistance. |
| 9 | + |
| 10 | +## Requirements |
| 11 | + |
| 12 | +- The app must be built (any configuration works for CLI method) |
| 13 | +- For keyboard/menu methods: the app must be running in **Debug** configuration |
| 14 | +- On first use, macOS may prompt for Screen Recording permission (non-IGraphics builds only) |
| 15 | + |
| 16 | +## Taking a Screenshot |
| 17 | + |
| 18 | +### Method 1: Command Line (Recommended for automation) |
| 19 | +Run the app with `--screenshot <path>`: |
| 20 | +```bash |
| 21 | +./build-ninja/out/TemplateProject.app/Contents/MacOS/TemplateProject --screenshot screenshot.png |
| 22 | +``` |
| 23 | + |
| 24 | +The app will launch, render the GUI, save the screenshot, and exit automatically. This method: |
| 25 | +- Skips audio/MIDI initialization for faster startup |
| 26 | +- Works headlessly (no user interaction required) |
| 27 | +- Is ideal for CI/CD and AI-assisted iteration |
| 28 | + |
| 29 | +### Method 2: Keyboard Shortcut |
| 30 | +With the app in focus, press: |
| 31 | +- **macOS:** `Cmd+Shift+S` |
| 32 | +- **Windows:** `Ctrl+Shift+S` |
| 33 | + |
| 34 | +### Method 3: Menu |
| 35 | +1. Open the **Debug** menu |
| 36 | +2. Click **Save Screenshot** |
| 37 | + |
| 38 | +## Screenshot Location |
| 39 | + |
| 40 | +Screenshots are saved to the system temp directory with a timestamp: |
| 41 | +``` |
| 42 | +{TMPDIR}/{PluginName}_screenshot_YYYYMMDD_HHMMSS.png |
| 43 | +``` |
| 44 | + |
| 45 | +On macOS, `TMPDIR` is typically `/var/folders/.../T/` |
| 46 | + |
| 47 | +After saving, a dialog appears with the full path and an option to open the file. |
| 48 | + |
| 49 | +## Viewing Screenshots in Claude Code |
| 50 | + |
| 51 | +When using the CLI method, the screenshot is saved directly to the specified path: |
| 52 | +```bash |
| 53 | +./MyPlugin.app/Contents/MacOS/MyPlugin --screenshot screenshot.png |
| 54 | +# Then read screenshot.png |
| 55 | +``` |
| 56 | + |
| 57 | +For interactive screenshots (keyboard/menu), find the most recent one: |
| 58 | +```bash |
| 59 | +ls -t $TMPDIR/*_screenshot_*.png | head -1 |
| 60 | +``` |
| 61 | + |
| 62 | +Then ask Claude Code to read the screenshot file. |
| 63 | + |
| 64 | +## Troubleshooting |
| 65 | + |
| 66 | +### No Debug menu visible |
| 67 | +- Ensure the app is built with **Debug** configuration |
| 68 | +- For CMake builds: `cmake -B build -DCMAKE_BUILD_TYPE=Debug` |
| 69 | +- For Xcode builds: Select "Debug" configuration |
| 70 | + |
| 71 | +### Screenshot is blank |
| 72 | +- This can happen with certain GPU-accelerated views |
| 73 | +- The IGraphics-based screenshot (used when IGraphics is available) should work with Metal/NanoVG/Skia backends |
| 74 | + |
| 75 | +### Permission denied on macOS |
| 76 | +- Go to System Preferences > Privacy & Security > Screen Recording |
| 77 | +- Enable permission for the app or Terminal |
| 78 | + |
| 79 | +## Technical Details |
| 80 | + |
| 81 | +The screenshot feature uses: |
| 82 | +- **IGraphics builds:** Layer-based capture via `IGraphics::SaveScreenshot()` - works with all backends |
| 83 | +- **Non-IGraphics builds (Visage, SwiftUI, etc.):** `CGWindowListCreateImage` API via dlsym |
| 84 | + |
| 85 | +Screenshots are captured at full Retina/HiDPI resolution. |
0 commit comments