Skip to content

Instantly share code, notes, and snippets.

@activeguild
Last active December 18, 2022 12:39
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save activeguild/d649989c1860c076f2d2052a7875f8d1 to your computer and use it in GitHub Desktop.
Save activeguild/d649989c1860c076f2d2052a7875f8d1 to your computer and use it in GitHub Desktop.
#!/bin/bash
function watch_desktop() {
fswatch -e ".*" -i ".mov" ~/Desktop | while read filePath; do
if [ -f "${filePath}" ]; then
if [ -f "${filePath/.mov/.gif}" ]; then
echo 'exists.'
else
echo 'not exists.'
ffmpeg -i "$filePath" -r 30 -vf scale=680:-1 "${filePath/mov/gif}"
osascript -e "display notification \"${filePath/mov/gif}\" with title \"Conversion to gif completed.\" sound name \"default\""
fi
fi
done
}
watch_desktop
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment