Skip to content

Instantly share code, notes, and snippets.

@edderrd
Forked from ttscoff/finished.rb
Last active December 27, 2015 14:59
Show Gist options
  • Save edderrd/7344630 to your computer and use it in GitHub Desktop.
Save edderrd/7344630 to your computer and use it in GitHub Desktop.
#!/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}", :sender => "com.googlecode.iterm2")
# %x{/usr/bin/terminal-notifier -message "#{message}" -title "Finished in #{project}" -activate #{activate}}
@edderrd
Copy link
Author

edderrd commented Nov 6, 2013

Fixed sender issue in Mavericks

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment