-
Notifications
You must be signed in to change notification settings - Fork 9.9k
feat: Add clipboard image pasting with cross-platform support #13645
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: main
Are you sure you want to change the base?
Conversation
- Remove debug logging from InputPrompt.tsx - Remove test scripts (test-clipboard-wsl.sh, copy-test-image.ps1) - Remove TEST-CLIPBOARD-PASTE.md - Add .gemini-debug.log to .gitignore - Remove test clipboard image artifacts
…support - Changed image filenames from timestamp-based (clipboard-1234567890.png) to sequential numbering (image-1.png, image-2.png) - Updated display format to show friendly labels: [image google-gemini#1] @path instead of just @path - Added Shift+Insert as alternative paste key binding for PowerShell compatibility (PowerShell intercepts Ctrl+V) - Updated cleanup function to handle both old and new filename formats This addresses the PowerShell Ctrl+V limitation and improves UX with clearer image references.
…unused restart support. (google-gemini#13565)
…le-gemini#13600) Co-authored-by: jacob314 <[email protected]>
|
Thanks for your pull request! It looks like this may be your first contribution to a Google open source project. Before we can look at your pull request, you'll need to sign a Contributor License Agreement (CLA). View this failed invocation of the CLA check for more information. For the most up to date status, view the checks section at the bottom of the pull request. |
Users now see clean labels like [image google-gemini#1], [image google-gemini#2] instead of full paths. The system automatically transforms these to @.gemini-clipboard/image-N.png when submitting. Display: [image google-gemini#1] [image google-gemini#2] Internal: @.gemini-clipboard/image-1.png @.gemini-clipboard/image-2.png
|
Hey tests are failing, could you take a look and fix them? |
Summary
Enables users to paste images directly from their clipboard into the Gemini CLI using
Ctrl+VorShift+Insert. Images are automatically saved to.gemini-clipboard/directory with sequentialnumbering and displayed with clean
[image #N]labels that convert to file references when submitted.This feature provides seamless image sharing across all platforms including macOS, Windows, Linux, and
WSL environments.
Details
Key Features:
image-1.png,image-2.png, etc.[image #1]in the input, converts to@.gemini-clipboard/image-1.pngon submit
Ctrl+VandShift+InsertTIFF)
Implementation:
clipboardUtils.tswith clipboard detection and image saving logicInputPromptcomponent to handle clipboard paste events@crosscopy/clipboardpackage for cross-platform clipboard supportFiles Changed:
packages/cli/src/ui/utils/clipboardUtils.ts- Core clipboard functionalitypackages/cli/src/ui/components/InputPrompt.tsx- UI integration and display formatpackages/cli/src/config/keyBindings.ts- Added Shift+Insert bindingpackages/cli/src/ui/utils/screenshotUtils.ts- Screenshot utilitiesRelated Issues
How to Validate
On macOS/Linux:
npm run devornpx @google/generative-ai-cliCtrl+VorShift+Insertin the input prompt[image #1]appears in the input.gemini-clipboard/image-1.pngexistsOn Windows (native):
npm run devornpxCtrl+Vand verify image paste worksOn WSL:
Ctrl+Vin the CLI.gemini-clipboard/image-N.pngis created in WSL filesystemTest sequential numbering:
[image #1],[image #2],[image #3], etc.Test cleanup:
.gemini-clipboard/Pre-Merge Checklist