Skip to content

Commit

Permalink
Improves notification messages [tj#23]
Browse files Browse the repository at this point in the history
  • Loading branch information
stephenmckinney committed Dec 7, 2012
1 parent 0c78130 commit c2eb6fc
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 9 deletions.
13 changes: 8 additions & 5 deletions lib/pomo/notifier.rb
Expand Up @@ -15,19 +15,22 @@ class Notifier

##
# Send message to notification library.
def self.notify(message, type = nil)
def self.notify(message, subtitle = '', type = nil)
title = 'Pomo'
full_message = [subtitle, message].join(' ')

if MACOS
if (10.8 <= MACOS_VERSION)
TerminalNotifier.notify message, :title => "Pomo"
TerminalNotifier.notify message, :title => title, :subtitle => subtitle
else
if type.equal? :warning
Growl.notify_warning message
Growl.notify_warning full_message
else
Growl.notify_info message
Growl.notify_info full_message
end
end
else
Libnotify.show :body => message, :summary => "Pomo"
Libnotify.show :body => full_message, :summary => title
end
end

Expand Down
8 changes: 4 additions & 4 deletions lib/pomo/task.rb
Expand Up @@ -50,7 +50,7 @@ def complete?
# Start timing the task.

def start
complete_message = "time is up! hope you are finished #{self}"
complete_message = "Time is up! Hope you are finished #{self}"
format_message = "(:progress_bar) :remaining minutes remaining"
progress(
(0..length).to_a.reverse,
Expand All @@ -59,15 +59,15 @@ def start
:complete_message => complete_message
) do |remaining|
if remaining == length / 2
Pomo::Notifier.notify "#{remaining} minutes remaining, half way there!"
Pomo::Notifier.notify "Half way there!", "#{remaining} minutes remaining"
elsif remaining == 5
Pomo::Notifier.notify "5 minutes remaining"
Pomo::Notifier.notify "Almost there!", "5 minutes remaining"
end
sleep 60
{ :remaining => remaining }
end
@complete = true
Pomo::Notifier.notify complete_message, :warning
Pomo::Notifier.notify "Hope you are finished #{self}", "Time is up!", :warning
end

end
Expand Down

0 comments on commit c2eb6fc

Please sign in to comment.