Last active
January 7, 2019 11:55
-
-
Save JTBrinkmann/4806903b6493ff5c830f45654c5bff39 to your computer and use it in GitHub Desktop.
small bash function to trigger a toast notification under Bash on Windows; e.g. at the end of a long running task
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
toast() { | |
powershell.exe -NoProfile -C "if (Get-Module -ListAvailable -Name BurntToast) { toast -t \"$*\" } else { echo 'Please run \`Install-Module -Name BurntToast\` in a Powershell as administrator'; echo \"$*\" }" | |
} | |
toast_title_body() { | |
toast $1\", \"$2 | |
} | |
longrunning() { | |
start=`date +%s` | |
$* | |
end=`date +%s` | |
runtime=$((end-start)) | |
if [ $runtime -gt 5 ]; then | |
toast_title_body "command finished (${runtime}s)" "$*" | |
fi | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment