Created
February 28, 2013 10:54
-
-
Save 0atman/5055897 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/usr/bin/env python | |
""" | |
Copyright (c) 2009 Blackgate Research. | |
This work is made available under the terms of the Creative Commons Attribution-ShareAlike 3.0 license, | |
http://creativecommons.org/licenses/by-sa/3.0/." | |
""" | |
import time | |
import os | |
import sys | |
# Default values are 10 mins work, 2 mins play. | |
# Feel free to change to whatever works for you. | |
work = 600 | |
play = 120 | |
# Command to run each work/play play/work transition | |
notify_cmd = 'aplay /usr/share/sounds/speech-dispatcher/test.wav -q' | |
# Text to display | |
notify_text = (lambda: sys.argv[1] if len(sys.argv) > 1 else "WORK")() | |
# Main loop | |
while 1: | |
os.system("clear") | |
os.popen('notify-send "%s"' % notify_text) | |
for i in range(0, work): | |
print "%s" % notify_text | |
print work - i | |
time.sleep(1) | |
os.system("clear") | |
os.popen(notify_cmd) | |
os.popen("notify-send PLAY") | |
for i in range(0, play): | |
print "PLAY" | |
print play - i | |
time.sleep(1) | |
os.system("clear") | |
os.popen(notify_cmd) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Originally found this method at http://www.43folders.com/2005/10/11/procrastination-hack-1025, it has become popularised as the "Pomodoro Technique".