Last active
August 8, 2018 20:04
-
-
Save catichenor/6ba19ff1d54ec6b5a31cdcb91f105b4a to your computer and use it in GitHub Desktop.
Simple Pomodoro timer for GNOME 3, this time with Python
This file contains hidden or 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/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