Skip to content

Instantly share code, notes, and snippets.

@3amprogrammer
Created June 14, 2019 16:47
Show Gist options
  • Save 3amprogrammer/05b97c4359a79733ebc40adf383a129f to your computer and use it in GitHub Desktop.
Save 3amprogrammer/05b97c4359a79733ebc40adf383a129f to your computer and use it in GitHub Desktop.
Mutagen Monitor
#!/bin/bash
function is_synced() {
output=`mutagen list`
if (echo ${output} | grep -q "Watching for changes"); then
echo 'yes'
else
echo 'no'
fi
}
was_synced=false
while :
do
synced=$(is_synced)
if [[ ${synced} = 'yes' ]] && [[ ${was_synced} = false ]]; then
osascript -e 'display notification "Synced ✅" with title "Mutagen Monitor"'
was_synced=true
elif [[ ${synced} = 'no' ]] && [[ ${was_synced} = true ]]; then
was_synced=false
fi
sleep 1
done
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment