Last active
January 10, 2021 22:19
-
-
Save porglezomp/9e8a57988f322500ed1f76364546bf49 to your computer and use it in GitHub Desktop.
Send a notification when a long-running command finishes.
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
# I have this inside my .config/fish/config.fish, but you migh be able to put it in .config/fish/functions ? | |
function show_notif --on-event fish_postexec | |
set -l duration $CMD_DURATION | |
set -l command $argv | |
if [ $duration -gt 10000 ] | |
set -l is_front (osascript -e 'tell application "Terminal" to frontmost') | |
if [ $is_front != "true" ] | |
osascript -e "display notification \"Command `$command` finished running after "(expr $duration / 1000)"s\" with title \"Command finished\"" | |
end | |
end | |
end |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment