2019-10-21 00:14:56 +03:00
|
|
|
#!/usr/bin/python3
|
|
|
|
import notify2
|
2019-10-21 14:14:15 +03:00
|
|
|
import gtk
|
2019-10-21 00:14:56 +03:00
|
|
|
from time import sleep
|
2019-10-21 14:14:15 +03:00
|
|
|
from playsound import playsound
|
2019-10-21 00:14:56 +03:00
|
|
|
|
|
|
|
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():
|
2019-10-21 14:14:15 +03:00
|
|
|
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))
|
2019-10-21 00:14:56 +03:00
|
|
|
notification.set_timeout(TIMEOUT * MILLISECOND)
|
|
|
|
notification.set_urgency(notify2.URGENCY_LOW)
|
|
|
|
notification.show()
|
2019-10-21 14:14:15 +03:00
|
|
|
playsound('files/default.wav')
|
2019-10-21 00:14:56 +03:00
|
|
|
sleep(TIMEOUT)
|
|
|
|
notification.close()
|
2019-10-21 14:14:15 +03:00
|
|
|
playsound('files/default.wav')
|
2019-10-21 00:14:56 +03:00
|
|
|
|
|
|
|
if __name__ == '__main__':
|
|
|
|
init()
|
|
|
|
send_notification()
|
|
|
|
uninit()
|