Permalink
Browse files

Merge pull request #6 from benedmunds/master

Add NotificationCenter support if available
  • Loading branch information...
2 parents 9ca0be4 + ced4790 commit 732a4d0517f0762bd348ebf74d9d73b639a9d6e4 @steveklabnik committed Nov 2, 2012
Showing with 12 additions and 2 deletions.
  1. +11 −2 lib/pomodoro.rb
  2. +1 −0 pomodoro.gemspec
View
@@ -2,6 +2,7 @@
require "bundler/setup"
require 'sinatra'
require 'noprocrast'
+require 'terminal-notifier'
module Pomodoro
class << self
@@ -28,11 +29,19 @@ def work
end
def break_growl
- system 'growlnotify -w -n Pomodoro -m "You have 5 minutes." "BREAK TIME"'
+ if (TerminalNotifier.available?) then
+ TerminalNotifier.notify('You have 5 minutes.', :title => 'Pomodoro', :subtitle => 'BREAK TIME')
+ else
+ system 'growlnotify -w -n Pomodoro -m "You have 5 minutes." "BREAK TIME"'
+ end
end
def work_growl
- system 'growlnotify -w -n Pomodoro -m "This lasts 25 minutes." "WORK TIME"'
+ if (TerminalNotifier.available?) then
+ TerminalNotifier.notify('This lasts 25 minutes.', :title => 'Pomodoro', :subtitle => 'WORK TIME')
+ else
+ system 'growlnotify -w -n Pomodoro -m "This lasts 25 minutes." "WORK TIME"'
+ end
end
end
View
@@ -20,4 +20,5 @@ Gem::Specification.new do |s|
s.add_dependency("noprocrast")
s.add_dependency("thin")
s.add_dependency("sinatra")
+ s.add_dependency("terminal-notifier")
end

0 comments on commit 732a4d0

Please sign in to comment.