aider icon indicating copy to clipboard operation
aider copied to clipboard

Add /addimgclipboard

Open jarca0123 opened this issue 1 year ago • 3 comments

This adds a simple command to retrieve an image from clipboard and save it to a temporary file. This is a feature that was requested here: #751. I don't know if it works in Windows and Mac.

jarca0123 avatar Jul 02 '24 13:07 jarca0123

Great suggestion. I suggest some enhancements. Is it possible to make custom commands, it would be handy to be able to use /XXX where XXX is my own python script. I'm using aider in WSL and I added a script that automatically fetches the latest Windows snipping tool snip from /mnt/c/Users/username/Pictures/Screenshots, using the timestamp to find the most recent. This method should hopefully work with most OS, just requiring the user to enter the file path to their screenshot directory. I then used /add to add the image. But the process is too manual, I'd like to have a /snip command that does all this in one step, along with some checking such as ensuring file is below a certain size. I'm happy to write the code myself and submit a PR, but would appreciate some conversation first about custom commands, and also what the general plan is for supporting images. @paul-gauthier . Congratulations on a great project, I love this tool.

lockmeister avatar Jul 10 '24 20:07 lockmeister

at this time, the fastest way I've found to add screenshots in WSL is through a simple script:

snip() {
    screenshot_dir="/mnt/c/Users/bob.jones/Pictures/Screenshots"
    latest_screenshot=$(find "$screenshot_dir" -type f -printf '%T@ %p\n' | sort -n | tail -1 | cut -f2- -d" ")
    if [ -n "$latest_screenshot" ]; then
        cp "$latest_screenshot" ./snip.png
        echo "Latest screenshot copied to ./snip.png"
    else
        echo "No screenshots found in $screenshot_dir"
    fi
}

I first run !snip then /add snip.png It's a bit manual.

lockmeister avatar Jul 12 '24 01:07 lockmeister

I forked aider and wrote a new command /snip which worked, but trying to make the tests work using mock took me too long

lockmeister avatar Jul 12 '24 01:07 lockmeister

Thanks for this PR. I had aider implement a similar /add-clipboard-image command, with a bit more clean handling of the temp image file.

paul-gauthier avatar Aug 01 '24 17:08 paul-gauthier