diff --git a/.vscode/launch.json b/.vscode/launch.json new file mode 100644 index 0000000..17e15f2 --- /dev/null +++ b/.vscode/launch.json @@ -0,0 +1,15 @@ +{ + // Use IntelliSense to learn about possible attributes. + // Hover to view descriptions of existing attributes. + // For more information, visit: https://go.microsoft.com/fwlink/?linkid=830387 + "version": "0.2.0", + "configurations": [ + { + "name": "Python: Current File", + "type": "python", + "request": "launch", + "program": "${file}", + "console": "integratedTerminal" + } + ] +} \ No newline at end of file diff --git a/Files/default.mp3 b/Files/default.mp3 new file mode 100644 index 0000000..0b082c8 Binary files /dev/null and b/Files/default.mp3 differ diff --git a/Files/eye_dark.png b/Files/eye_dark.png new file mode 100644 index 0000000..e22b74c Binary files /dev/null and b/Files/eye_dark.png differ diff --git a/Files/eye_light.png b/Files/eye_light.png new file mode 100644 index 0000000..05e4560 Binary files /dev/null and b/Files/eye_light.png differ diff --git a/README.md b/README.md index 2e48aa1..2dfcdc8 100644 --- a/README.md +++ b/README.md @@ -1,3 +1,9 @@ # EyeStrainReminder -A small background tool to remind the user of the "20-20-20" rule. \ No newline at end of file +A small background tool to remind the user of the "20-20-20" rule. + +``` +sudo apt-get install python-gobject libnotify-bin python-gst-1.0 + +pip3 install notify2 +``` \ No newline at end of file diff --git a/main.py b/main.py new file mode 100644 index 0000000..599e16d --- /dev/null +++ b/main.py @@ -0,0 +1,30 @@ +#!/usr/bin/python3 +import notify2 +from time import sleep +#from playsound import playsound + +NAME = 'Eye Strain Reminder' +MESSAGE = 'Friendly reminder to observe the 20-20-20 rule' +TIMEOUT = 20 +MILLISECOND = 1000 + +def init(): + notify2.init(NAME) + +def uninit(): + notify2.uninit() + +def send_notification(): + #playsound('files/default.mp3') + notification = notify2.Notification(NAME, MESSAGE) + notification.set_timeout(TIMEOUT * MILLISECOND) + notification.set_urgency(notify2.URGENCY_LOW) + notification.show() + sleep(TIMEOUT) + notification.close() + #playsound('files/default.mp3') + +if __name__ == '__main__': + init() + send_notification() + uninit() \ No newline at end of file