Advertisement
Guest User

Untitled

a guest
Jun 30th, 2016
50
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.98 KB | None | 0 0
  1. function fish_right_prompt
  2. if test $CMD_DURATION
  3. # Store duration of last command
  4. set duration (echo "$CMD_DURATION 1000" | awk '{printf "%.3fs", $1 / $2}')
  5.  
  6. # OS X notification when a command takes longer than notify_duration
  7. set notify_duration 10000
  8. set exclude_cmd "zsh|bash|less|man|more|ssh|drush php"
  9. if begin
  10. test $CMD_DURATION -gt $notify_duration
  11. and echo $history[1] | grep -vqE "^($exclude_cmd).*"
  12. end
  13.  
  14. # Only show the notification if iTerm is not focused
  15. echo "
  16. tell application \"System Events\"
  17. set activeApp to name of first application process whose frontmost is true
  18. if \"iTerm\" is not in activeApp then
  19. display notification \"Finished in $duration\" with title \"$history[1]\"
  20. end if
  21. end tell
  22. " | osascript
  23. end
  24. end
  25. end
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement