Skip to content

Instantly share code, notes, and snippets.

@WengerK
Last active February 3, 2021 10:47
Show Gist options
  • Select an option

  • Save WengerK/ad0c1330966522c05f504d71d29f675b to your computer and use it in GitHub Desktop.

Select an option

Save WengerK/ad0c1330966522c05f504d71d29f675b to your computer and use it in GitHub Desktop.

Revisions

  1. WengerK revised this gist Aug 16, 2016. 1 changed file with 2 additions and 0 deletions.
    2 changes: 2 additions & 0 deletions README.md
    Original file line number Diff line number Diff line change
    @@ -1,3 +1,5 @@
    # Article Ressources - MacOS - Trigger Notification Center when long running commands finishes

    This is the Gist repository for my article **MacOS - Trigger Notification Center when long running commands finishes**.

    Be aware that this article has been wrote for the Blog of [Antistatique](https://antistatique.net) — Web Agency in Lausanne, Switzerland. A place where I work as Full Stack Web Developer.
  2. WengerK revised this gist Aug 6, 2016. 1 changed file with 1 addition and 1 deletion.
    2 changes: 1 addition & 1 deletion README.md
    Original file line number Diff line number Diff line change
    @@ -2,4 +2,4 @@ This is the Gist repository for my article **MacOS - Trigger Notification Center

    Be aware that this article has been wrote for the Blog of [Antistatique](https://antistatique.net) — Web Agency in Lausanne, Switzerland. A place where I work as Full Stack Web Developer.

    Feel free to read it the full article on [Medium](https://medium.com/@WengerK/macos-trigger-notification-center-when-long-running-commands-finishes) or check it out on [Antistatique](http://antistatique.dev/en/we/blog/2016/07/08/macos-trigger-notification-center-when-long-running-commands-finishes).
    Feel free to read it the full article on [Medium](https://medium.com/@WengerK/cli-trigger-notif-c98ca4d0ab30#.9e8pjo8vk) or check it out on [Antistatique](https://antistatique.net/fr/node/343).
  3. WengerK revised this gist Aug 3, 2016. 1 changed file with 2 additions and 1 deletion.
    3 changes: 2 additions & 1 deletion f_notifyme
    Original file line number Diff line number Diff line change
    @@ -3,4 +3,5 @@ function f_notifyme {
    CMD=$(fc -ln -1)
    # No point in waiting for the command to complete
    notify "$CMD" "$LAST_EXIT_CODE" &
    }
    }
    export PS1='$(f_notifyme)'$PS1
  4. WengerK revised this gist Jul 29, 2016. 1 changed file with 2 additions and 0 deletions.
    2 changes: 2 additions & 0 deletions notify.sh
    Original file line number Diff line number Diff line change
    @@ -1,3 +1,5 @@
    #!/usr/bin/env osascript

    on run argv
    tell application "System Events"
    set frontApp to name of first application process whose frontmost is true
  5. WengerK revised this gist Jul 27, 2016. 1 changed file with 1 addition and 1 deletion.
    2 changes: 1 addition & 1 deletion README.md
    Original file line number Diff line number Diff line change
    @@ -1,4 +1,4 @@
    This is the Gist repository for my article **Drupal 8  —  Differences between Configuration API & State API**.
    This is the Gist repository for my article **MacOS - Trigger Notification Center when long running commands finishes**.

    Be aware that this article has been wrote for the Blog of [Antistatique](https://antistatique.net) — Web Agency in Lausanne, Switzerland. A place where I work as Full Stack Web Developer.

  6. WengerK renamed this gist Jul 27, 2016. 1 changed file with 0 additions and 0 deletions.
    File renamed without changes.
  7. WengerK created this gist Jul 27, 2016.
    5 changes: 5 additions & 0 deletions README.md
    Original file line number Diff line number Diff line change
    @@ -0,0 +1,5 @@
    This is the Gist repository for my article **Drupal 8  —  Differences between Configuration API & State API**.

    Be aware that this article has been wrote for the Blog of [Antistatique](https://antistatique.net) — Web Agency in Lausanne, Switzerland. A place where I work as Full Stack Web Developer.

    Feel free to read it the full article on [Medium](https://medium.com/@WengerK/macos-trigger-notification-center-when-long-running-commands-finishes) or check it out on [Antistatique](http://antistatique.dev/en/we/blog/2016/07/08/macos-trigger-notification-center-when-long-running-commands-finishes).
    6 changes: 6 additions & 0 deletions f_notifyme
    Original file line number Diff line number Diff line change
    @@ -0,0 +1,6 @@
    function f_notifyme {
    LAST_EXIT_CODE=$?
    CMD=$(fc -ln -1)
    # No point in waiting for the command to complete
    notify "$CMD" "$LAST_EXIT_CODE" &
    }
    14 changes: 14 additions & 0 deletions notify
    Original file line number Diff line number Diff line change
    @@ -0,0 +1,14 @@
    on run argv
    tell application "System Events"
    set frontApp to name of first application process whose frontmost is true
    if frontApp is not "iTerm2" then
    set notifTitle to item 1 of argv
    set notifBody to "succeded"
    set errorCode to item 2 of argv
    if errorCode is not "0"
    set notifBody to "failed with error code " & errorCode
    end if
    display notification notifBody with title notifTitle
    end if
    end tell
    end run