mirror of
https://github.com/AyuGram/AyuGramDesktop.git
synced 2026-07-25 06:54:43 +00:00
[ai] Make /icon command work on macOS too.
This commit is contained in:
Executable
+28
@@ -0,0 +1,28 @@
|
||||
#!/bin/bash
|
||||
# Grab clipboard image on macOS and save as PNG.
|
||||
outPath="$1"
|
||||
if [ -z "$outPath" ]; then
|
||||
echo "Usage: grab_clipboard.sh <output.png>"
|
||||
exit 1
|
||||
fi
|
||||
|
||||
osascript -e '
|
||||
set theFile to POSIX file "'"$outPath"'"
|
||||
try
|
||||
set theImage to the clipboard as «class PNGf»
|
||||
on error
|
||||
return "no image"
|
||||
end try
|
||||
set fh to open for access theFile with write permission
|
||||
write theImage to fh
|
||||
close access fh
|
||||
return "ok"
|
||||
' 2>/dev/null | grep -q "ok"
|
||||
|
||||
if [ $? -eq 0 ]; then
|
||||
echo "Saved to $outPath"
|
||||
exit 0
|
||||
else
|
||||
echo "No image on clipboard"
|
||||
exit 1
|
||||
fi
|
||||
Reference in New Issue
Block a user