Skip to content

Instantly share code, notes, and snippets.

@catichenor
Last active August 8, 2018 20:04
Show Gist options
  • Select an option

  • Save catichenor/6ba19ff1d54ec6b5a31cdcb91f105b4a to your computer and use it in GitHub Desktop.

Select an option

Save catichenor/6ba19ff1d54ec6b5a31cdcb91f105b4a to your computer and use it in GitHub Desktop.
Simple Pomodoro timer for GNOME 3, this time with Python
#!/usr/bin/python
# Thanks to http://www.devdungeon.com/content/desktop-notifications-python-libnotify
import time
from datetime import datetime
from gi.repository import Notify
Notify.init('pomodoro_linux.py')
def create_notification(title, message):
Notify.Notification.new(title, message,).show()
def getTime():
return (str(datetime.now().hour) + ":" + str(datetime.now().minute).zfill(2))
def main():
while True:
print("Worktime: The time is " + getTime())
create_notification("Work", "Time to start working.")
time.sleep(1200)
print("Worktime: 5 minutes left. The time is " + getTime())
create_notification("Work", "5 minutes left.")
time.sleep(300)
print("Breaktime: The time is " + getTime())
create_notification("Break", "Time for a break.")
time.sleep(300)
Notify.uninit()
if __name__ == '__main__':
main()
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment