Last active
November 21, 2016 12:48
-
-
Save jan53n/9b51928664cfba4c2c0b5723e9252ed0 to your computer and use it in GitHub Desktop.
the usual pomodoro script (python, libnotify)
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 python3 | |
# notify works on ubuntu (libnotify library) | |
from sys import argv | |
import time | |
import subprocess | |
import threading | |
def notify(message): | |
subprocess.Popen(['notify-send', message]) | |
return | |
def alarm(sleep_for, message): | |
time.sleep(sleep_for) | |
t = threading.Thread(name='alarm', target=notify, args=(message, )) | |
t.start() | |
def pomodoros(count): | |
for p in range(count): | |
message = "P:" + str(p) + ", " | |
alarm(1500, message + "work") | |
alarm(300, message + "interval") | |
alarm(0, "pomodoro ended!") | |
return | |
if __name__ == "__main__": | |
count = int(argv[1]) if len(argv) > 1 else 1 | |
pomodoros(count) | |
exit(0) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment