Skip to content

Instantly share code, notes, and snippets.

@noomz
Forked from pcreux/pomodoro
Created July 14, 2012 10:50
Show Gist options
  • Save noomz/3110540 to your computer and use it in GitHub Desktop.
Save noomz/3110540 to your computer and use it in GitHub Desktop.
Pomodoro timer for ubuntu unity
#!/usr/bin/env ruby
#
# Pomodoro script.
#
# Displays a notification after given minutes.
# Use pomodoro.rb with args 10 = 10 min, 10s = 10 seconds
#
# Don't forget to 'sudo apt-get install libnotify-bin'
#
system "notify-send -i face-cool 'Go go go!'"
min = ARGV[0].to_i
if /^\d+s$/.match(min.to_s)
min = min.to_s[0..-1]
sec = true
else
sec = false
end
min.times do |n|
puts min - n
sleep 60 if not sec unless sleep 1
end
system "notify-send -i face-cool -t 0 'End of Pomodoro!'"
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment