Skip to content

Instantly share code, notes, and snippets.

@FOLLGAD
Created March 8, 2025 23:53
Show Gist options
  • Select an option

  • Save FOLLGAD/435ed12244ecdf7262c5bacdbb0a2bbe to your computer and use it in GitHub Desktop.

Select an option

Save FOLLGAD/435ed12244ecdf7262c5bacdbb0a2bbe to your computer and use it in GitHub Desktop.
#!/bin/bash
# Save screenshot with timestamp to Desktop
filename="$HOME/Pictures/Screens/Screenshot_$(date +%Y-%m-%d_%H.%M.%S).png"
screencapture -i "$filename"
# Copy the new file to clipboard if it exists (only if you didn't cancel the screenshot)
if [ -f "$filename" ]; then
osascript -e 'set the clipboard to (read (POSIX file "'"$filename"'") as TIFF picture)'
fi
context="{\"notifyOptions\":{\"title\":\"Screenshot taken\",\"subtitle\":\"Saved as $filename\",\"open\":\"file://$filename\",\"sound\":true}}"
deeplink="raycast://extensions/maxnyby/raycast-notification/index?launchType=background&context=$(jq -rR @uri <<< $context)"
open $deeplink
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment