Skip to content
Browse files

pomodoro: remind user when off and they're working

  • Loading branch information...
1 parent cf9dc83 commit ceaf82c42725b092d7a9c3094d24286fa9fdd7f0 Suraj N. Kurapati committed Sep 22, 2011
Showing with 15 additions and 0 deletions.
  1. +15 −0 display/status/pomodoro.yaml
View
15 display/status/pomodoro.yaml
@@ -10,6 +10,16 @@ display:
SECONDS_PER_POMODORO = MINUTES_PER_POMODORO * SECONDS_PER_MINUTE
@pomodoros ||= 0
+ # roughly record the time of user's last computer activity
+ @activity = Time.now
+ Thread.new do
+ Rumai.fs.event.each_line do |events|
+ if events =~ /^\w+Focus\b/
+ @activity = Time.now
+ end
+ end
+ end
+
def start
completed = Time.now >= @deadline if @deadline
@@ -73,6 +83,11 @@ display:
if minutes_remaining % 5 == 0 and minutes_remaining <= 0
tell_user_to_take_break
end
+
+ elsif seconds_to_minutes(Time.now - @activity) < 5
+ # remind the user that they started working on the computer without
+ # having activated the pomodoro timer; think of their health! >:-O
+ color = :error
end
[color, "\u2692",

0 comments on commit ceaf82c

Please sign in to comment.
Something went wrong with that request. Please try again.