Skip to content

Commit

Permalink
Focus the prior app once the user has answered the question.
Browse files Browse the repository at this point in the history
  • Loading branch information
cyberfox committed Feb 17, 2017
1 parent 80911b6 commit 773a29d
Showing 1 changed file with 2 additions and 0 deletions.
2 changes: 2 additions & 0 deletions app/app_delegate.rb
Original file line number Diff line number Diff line change
Expand Up @@ -35,6 +35,7 @@ def ask_early
end

def ask_and_schedule
old_app = NSWorkspace.sharedWorkspace.frontmostApplication
@timer = nil
begin
ask
Expand All @@ -47,6 +48,7 @@ def ask_and_schedule
# -5..5 + 20 yields a range of 15-25 minutes.
wait_time = (((rand*10).to_i-5)+20)*60
@timer = NSTimer.scheduledTimerWithTimeInterval(wait_time, target: self, selector: 'ask_and_schedule', userInfo: nil, repeats: false)
old_app.activateWithOptions(NSApplicationActivateIgnoringOtherApps)
end

FMT = NSDateFormatter.new
Expand Down

0 comments on commit 773a29d

Please sign in to comment.