Skip to content

Commit 0c1e2ef

Browse files
committed
WIP - Add Screenshot Capability
1 parent ba46a22 commit 0c1e2ef

File tree

4 files changed

+91
-0
lines changed

4 files changed

+91
-0
lines changed

.claude/skills/screenshot/SKILL.md

Lines changed: 85 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,85 @@
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.

TemplateProject/resources/main.rc

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -90,6 +90,8 @@ BEGIN
9090
MENUITEM "&Show Control Bounds\tCtrl+B", ID_SHOW_BOUNDS
9191
MENUITEM "&Show Drawn Area\tCtrl+D", ID_SHOW_DRAWN
9292
MENUITEM "&Show FPS\tCtrl+F", ID_SHOW_FPS
93+
MENUITEM SEPARATOR
94+
MENUITEM "&Save Screenshot\tCtrl+Shift+S", ID_SCREENSHOT
9395
END
9496
POPUP "&Help"
9597
BEGIN
@@ -176,6 +178,7 @@ BEGIN
176178
"D", ID_SHOW_DRAWN, VIRTKEY, CONTROL, NOINVERT
177179
"F", ID_SHOW_FPS, VIRTKEY, CONTROL, NOINVERT
178180
"E", ID_LIVE_EDIT, VIRTKEY, CONTROL, NOINVERT
181+
"S", ID_SCREENSHOT, VIRTKEY, CONTROL, SHIFT, NOINVERT
179182
END
180183

181184
/////////////////////////////////////////////////////////////////////////////

TemplateProject/resources/main.rc_mac_menu

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -10,6 +10,8 @@ SWELL_DEFINE_MENU_RESOURCE_BEGIN(IDR_MENU1)
1010
MENUITEM "&Show Control Bounds\tCtrl+B", ID_SHOW_BOUNDS
1111
MENUITEM "&Show Drawn Area\tCtrl+D", ID_SHOW_DRAWN
1212
MENUITEM "&Show FPS\tCtrl+F", ID_SHOW_FPS
13+
MENUITEM SEPARATOR
14+
MENUITEM "&Save Screenshot\tCtrl+Shift+S", ID_SCREENSHOT
1315
END
1416
POPUP "&Help"
1517
BEGIN

TemplateProject/resources/resource.h

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -31,6 +31,7 @@
3131
#define ID_SHOW_DRAWN 40026
3232
#define ID_SHOW_FPS 40027
3333
#define ID_SHOW_BOUNDS 40028
34+
#define ID_SCREENSHOT 40029
3435

3536
// Next default values for new objects
3637
//

0 commit comments

Comments
 (0)