Skip to content

Instantly share code, notes, and snippets.

@benjamincharity
Last active August 25, 2025 15:46
Show Gist options
  • Save benjamincharity/70e583652a9d947b6f67ec6c1fc2379d to your computer and use it in GitHub Desktop.
Save benjamincharity/70e583652a9d947b6f67ec6c1fc2379d to your computer and use it in GitHub Desktop.
Screenshot support for claude from the CLI
## Custom Commands
When I type "ss" in a message, automatically run /usr/local/bin/lastshot.sh and use the Read tool to display my latest screenshot.
#!/bin/bash
# Find the latest CleanShot screenshot on Desktop (any format)
LATEST=$(ls -1t ~/Desktop/CleanShot\ *.png 2>/dev/null | head -n1)
# If we're in a code directory, create a symlink in tmp
if [[ "$PWD" == */code/* ]]; then
mkdir -p ./tmp
if [[ -n "$LATEST" ]]; then
ln -sf "$LATEST" ./tmp/latest_screenshot.png
echo "./tmp/latest_screenshot.png"
else
echo "No CleanShot screenshots found on Desktop"
exit 1
fi
else
if [[ -n "$LATEST" ]]; then
echo "$LATEST"
else
echo "No CleanShot screenshots found on Desktop"
exit 1
fi
fi
Add the custom command directly to your Claude.json.
Update the LATEST var with the location of your screenshots.
Add the pre-auth to Claude/settings.json
{
"permissions": {
"allow": [
"Bash(/usr/local/bin/lastshot.sh:*)",
"Read(//Users/bc/Desktop/**)"
]
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment