Last active
August 25, 2025 15:46
-
-
Save benjamincharity/70e583652a9d947b6f67ec6c1fc2379d to your computer and use it in GitHub Desktop.
Screenshot support for claude from the CLI
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
## 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. |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/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 |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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 |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
{ | |
"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