Repository navigation
feat(cookbook): add image-path-gallery recipe - #893
Conversation
One chord shows the image paths on a pane's screen in an overlay gallery. In an attached session it copies the files from the host first. Claude-Session: https://claude.ai/code/session_01GqkEnpmSQ9B16JabFfNGjx
umputun
left a comment
There was a problem hiding this comment.
lgtm, merging. One non-blocking note for a follow-up.
cookbook/image-path-gallery/image-path-gallery.sh:8 - tr -d '[:space:]' joins the whole screen into one string, so an earlier word with a slash swallows the image path whenever only letters, digits, ._-+@ and whitespace stand between them, across lines too. A reply like Updated src/views/settings.go and saved the screenshot to /tmp/shot.png gives one bogus path, and the chord says the file does not exist. Fix: join only line breaks and their indent, keep the spaces inside a line:
image_paths() {
perl -0777 -ne 's/[ \t\r]*\n[ \t]*//g; print "$1\n" while m{(/[A-Za-z0-9._/\@+-]+?\.(?:png|jpe?g|gif|webp))}gi' | awk '!seen[$0]++'
}the wrapped and indented paths from #887 still parse with it. The comment above the function and README lines 38 and 52 would need the same change. The case still lost is a line ending in a word with a slash right above the path line, src/a.txt on one line and /tmp/x.png on the next.
The recipe from discussion #887. One chord shows the image paths on a pane's screen in an overlay gallery with thumbnails. In an attached session it copies the files from the host first with
scp.It stays useful after #891:
--imageshows one file that a program on the origin names, and this recipe is for several paths that are already on the screen.I have used it for a short time only, about a day, on sessions attached from another Mac. I did not run it again under the new file name, it is the same script. I did not test it on 0.36.0, this minimum comes from the changelog.
shellcheckis clean. Text on the screen decides which files are copied, the first sentence in Limits says this.