Skip to content

Instantly share code, notes, and snippets.

@ttscoff
Created July 31, 2012 15:36
Show Gist options
  • Star 5 You must be signed in to star a gist
  • Fork 2 You must be signed in to fork a gist
  • Save ttscoff/3217879 to your computer and use it in GitHub Desktop.
Save ttscoff/3217879 to your computer and use it in GitHub Desktop.
A quick shell script that wraps the terminal-notifier for quick Mountain Lion notifications when a process finishes
#!/usr/bin/ruby
# finished: a quick script to notify you when a command is done using Mountain Lion notifications
# It grabs the current folder as the title and takes one argument as the message
# Example: make && make install && finished "Done compiling" || finished "compiler failed"
#
# Needs the terminal-notifier gem : `gem install terminal-notifier`
# Can alternately be used with the CLI <https://github.com/alloy/terminal-notifier>
# (remove require block below and swap comment lines at the bottom)
require 'rubygems'
require 'terminal-notifier'
message = ARGV[0] || "Task completed"
project = Dir.pwd.split('/')[-3..-1].join('/')
activate = 'com.googlecode.iterm2'
TerminalNotifier.notify(message, :activate => activate, :title => "Finished in #{project}")
# %x{/usr/bin/terminal-notifier -message "#{message}" -title "Finished in #{project}" -activate #{activate}}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment