33 lines
839 B
Python
Executable File
33 lines
839 B
Python
Executable File
#!/usr/bin/python3
|
|
import notify2
|
|
import gtk
|
|
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():
|
|
notification = notify2.Notification(NAME, MESSAGE, "notification-device-eject")
|
|
|
|
#notification.set_icon_from_pixbuf(gtk.Label().render_icon(gtk.STOCK_DIALOG_INFO, gtk.ICON_SIZE_LARGE_TOOLBAR))
|
|
notification.set_timeout(TIMEOUT * MILLISECOND)
|
|
notification.set_urgency(notify2.URGENCY_LOW)
|
|
notification.show()
|
|
playsound('files/default.wav')
|
|
sleep(TIMEOUT)
|
|
notification.close()
|
|
playsound('files/default.wav')
|
|
|
|
if __name__ == '__main__':
|
|
init()
|
|
send_notification()
|
|
uninit() |