πΈ Screenshot Directory UI Enhancement & File Saving Fix
Problem Statement
Current screenshot functionality captures data but doesn't save files when using the UI button (direct flow). User needs better control over where screenshots are saved with improved UX.
Current Issues
- Missing File Saving: UI button captures screenshots but files aren't saved to disk
- Confusing Directory Input: Text field unclear about where files actually go
- No User Control: Can't easily choose save location
- Static UI Preview: Hardcoded placeholder instead of dynamic filename
Implementation Decision: Use HTTP Bridge for UI Clicks β
Chosen Approach: Option A - Use HTTP Bridge for UI clicks with proper circular dependency handling
Benefits:
- Consistent saving mechanism (UI and MCP both use HTTP bridge)
- Files saved to configured directory location
- Reuses existing HTTP bridge file saving infrastructure
- Centralized file management
Proposed Solution: Two-Phase Implementation
Phase 1: Fix File Saving (HTTP Bridge Method)
Implementation:
// Change UI button to use HTTP bridge (in screenshot.js)
const result = await this.captureViaBackground(
selector,
fullPage,
smartFilename,
format,
quality,
true // sendToHttpBridge: true for UI clicks
);
// Properly handle circular dependency with improved WebSocket flow
// Background.js β HTTP bridge β WebSocket β Screenshot.js response
Circular Dependency Solution:
- UI button β background.js β HTTP bridge (file saved) β WebSocket response β screenshot.js
- Remove the circular loop by ensuring WebSocket response completes the flow
- File saving happens in HTTP bridge, not triggered again by WebSocket
Phase 2: Enhance Directory UI
Current UI:
<input type="text" id="screenshot-path" placeholder="/path/to/screenshots" />
New Design:
<div class="input-row">
<div style="width: 80%" class="directory-display">
πΎ /Users/username/Downloads/screenshots/
</div>
<div style="width: 20%">
<button class="btn success" id="choose-directory-btn">Save to...</button>
</div>
</div>
Add Clipboard Options:
<div style="display: flex; justify-content: space-between; align-items: center; margin-top: 2px;">
<div style="font-size: 9px; color: #d4d4d8; font-weight: 500">
Screenshots Directory:
</div>
<div style="display: flex; gap: 8px;">
<label class="label" style="font-size: 8px;">
<input type="checkbox" class="checkbox" id="add-to-clipboard-cb" />
Add to Clipboard π
</label>
<label class="label" style="font-size: 8px;">
<input type="checkbox" class="checkbox" id="auto-paste-cb" />
Auto-Paste πΈ to Client
</label>
</div>
</div>
UI Changes Needed
1. Transform Directory Display (Panel 1)
- Replace text input with read-only directory display
- Add "Save to..." button (20% width, green success class)
- Show current save location with folder emoji
- Use monospace font for path clarity
2. Add Screenshot Options Checkboxes
- Add to Clipboard π - Copy screenshot to system clipboard
- Auto-Paste πΈ to Client - Existing functionality (moved right)
- Both checkboxes on same row, right-aligned
3. Add Directory Picker Functionality
- "Save to..." button opens directory picker
- Updates display when user selects new directory
- Validates directory exists and is writable
- Stores selection in extension settings
4. Update Screenshot Preview (Panel 2)
- Replace hardcoded "page-title_2025-09-17_0001.png" with dynamic preview
- Show actual next filename based on current page title
- Update "Last" to show most recent actual screenshot
Technical Implementation
Phase 1: HTTP Bridge File Saving
// In screenshot.js - change UI button flow
async function captureScreenshot(options = {}) {
// UI button now uses HTTP bridge for file saving
const result = await this.captureViaBackground(
selector,
fullPage,
filename,
format,
quality,
true // sendToHttpBridge: true
);
// Handle clipboard option
if (settings.addToClipboard && result.success) {
await this.copyToClipboard(result.data);
}
}
Directory Picker (Phase 2)
// Use Chrome File System Access API
async function chooseDirectory() {
const directoryHandle = await window.showDirectoryPicker();
const directoryPath = await directoryHandle.name;
settings.screenshotDirectory = directoryPath;
updateDirectoryDisplay(directoryPath);
}
Clipboard Integration
// Add to clipboard functionality
async function copyToClipboard(screenshotData) {
const blob = dataURLtoBlob(screenshotData);
const item = new ClipboardItem({ 'image/png': blob });
await navigator.clipboard.write([item]);
}
Files to Modify
Phase 1 (File Saving):
screenshot.js - Change UI button to use sendToHttpBridge: true
background.js - Ensure HTTP bridge flow works properly
panel.js - Add clipboard settings handling
Phase 2 (UI Enhancement):
panel-ui-change-test.html - Create test UI file
panel.html - Final UI updates with new checkboxes
panel.js - Directory picker logic + clipboard handling
- CSS updates for directory display styling
User Experience Flow
- File Saving Fixed: Screenshot button saves actual files via HTTP bridge
- Choose Options: Check "Add to Clipboard π" and/or "Auto-Paste πΈ to Client"
- Choose Location: Click "Save to..." β Select directory
- Visual Feedback: See current save location:
πΎ /Users/me/Pictures/
- Take Screenshot:
- File saved to chosen directory via HTTP bridge
- Optionally copied to clipboard
- Optionally auto-pasted to client
Settings Schema Update
settings = {
// ... existing settings
screenshotDirectory: '/Users/username/Downloads/screenshots/',
addToClipboard: false, // NEW: Copy to clipboard option
autoPaste: false, // Existing: Auto-paste to client
saveMethod: 'http-bridge' // Force HTTP bridge for consistency
}
Benefits
β
Files Actually Saved: Via HTTP bridge (consistent with MCP)
β
Clipboard Integration: Optional copy to system clipboard
β
User Control: Choose exact save location
β
Clear Feedback: See where files will be saved
β
Consistent UX: Matches system file picker patterns
β
No Circular Dependencies: Proper WebSocket flow handling
β
Visual Consistency: Matches existing panel design
β
Responsive Design: Works on all screen sizes
Testing Checklist
Priority: High (Phase 1 critical - screenshots not saving!)
Difficulty: Medium
Agent: Agent D - Screenshot Visualizer
Implementation Decision: β
HTTP Bridge Method Chosen
Dependencies: None
πΈ Screenshot Directory UI Enhancement & File Saving Fix
Problem Statement
Current screenshot functionality captures data but doesn't save files when using the UI button (direct flow). User needs better control over where screenshots are saved with improved UX.
Current Issues
Implementation Decision: Use HTTP Bridge for UI Clicks β
Chosen Approach: Option A - Use HTTP Bridge for UI clicks with proper circular dependency handling
Benefits:
Proposed Solution: Two-Phase Implementation
Phase 1: Fix File Saving (HTTP Bridge Method)
Implementation:
Circular Dependency Solution:
Phase 2: Enhance Directory UI
Current UI:
New Design:
Add Clipboard Options:
UI Changes Needed
1. Transform Directory Display (Panel 1)
2. Add Screenshot Options Checkboxes
3. Add Directory Picker Functionality
4. Update Screenshot Preview (Panel 2)
Technical Implementation
Phase 1: HTTP Bridge File Saving
Directory Picker (Phase 2)
Clipboard Integration
Files to Modify
Phase 1 (File Saving):
screenshot.js- Change UI button to usesendToHttpBridge: truebackground.js- Ensure HTTP bridge flow works properlypanel.js- Add clipboard settings handlingPhase 2 (UI Enhancement):
panel-ui-change-test.html- Create test UI filepanel.html- Final UI updates with new checkboxespanel.js- Directory picker logic + clipboard handlingUser Experience Flow
πΎ /Users/me/Pictures/Settings Schema Update
Benefits
β Files Actually Saved: Via HTTP bridge (consistent with MCP)
β Clipboard Integration: Optional copy to system clipboard
β User Control: Choose exact save location
β Clear Feedback: See where files will be saved
β Consistent UX: Matches system file picker patterns
β No Circular Dependencies: Proper WebSocket flow handling
β Visual Consistency: Matches existing panel design
β Responsive Design: Works on all screen sizes
Testing Checklist
Priority: High (Phase 1 critical - screenshots not saving!)
Difficulty: Medium
Agent: Agent D - Screenshot Visualizer
Implementation Decision: β HTTP Bridge Method Chosen
Dependencies: None