Skip to content

Commit

Permalink
pomodoro: remind user when off and they're working
Browse files Browse the repository at this point in the history
  • Loading branch information
sunaku committed Sep 22, 2011
1 parent cf9dc83 commit ceaf82c
Showing 1 changed file with 15 additions and 0 deletions.
15 changes: 15 additions & 0 deletions display/status/pomodoro.yaml
Expand Up @@ -10,6 +10,16 @@ display:
SECONDS_PER_POMODORO = MINUTES_PER_POMODORO * SECONDS_PER_MINUTE SECONDS_PER_POMODORO = MINUTES_PER_POMODORO * SECONDS_PER_MINUTE
@pomodoros ||= 0 @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 def start
completed = Time.now >= @deadline if @deadline completed = Time.now >= @deadline if @deadline
Expand Down Expand Up @@ -73,6 +83,11 @@ display:
if minutes_remaining % 5 == 0 and minutes_remaining <= 0 if minutes_remaining % 5 == 0 and minutes_remaining <= 0
tell_user_to_take_break tell_user_to_take_break
end 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 end
[color, "\u2692", [color, "\u2692",
Expand Down

0 comments on commit ceaf82c

Please sign in to comment.