Skip to content

Instantly share code, notes, and snippets.

@activeguild
Last active December 16, 2022 19:59
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/c28d7e2f2ac859c150bd294daea3f74e to your computer and use it in GitHub Desktop.
Save activeguild/c28d7e2f2ac859c150bd294daea3f74e to your computer and use it in GitHub Desktop.
#!/opt/homebrew/bin/fish
function watch_desktop
fswatch -e ".*" -i ".mov" ~/Desktop | while read filePath;
set replacedFilePath (string replace .mov .gif $filePath)
if test -e $filePath
if test -e $replacedFilePath
echo 'exists.'
else
echo 'not exists.'
ffmpeg -i "$filePath" -r 30 -vf scale=680:-1 "$replacedFilePath"
osascript -e "display notification \"$replacedFilePath\" with title \"Conversion to gif completed.\" sound name \"default\""
end
end
end
end
watch_desktop
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment