30 lines
681 B
Python
30 lines
681 B
Python
|
#!/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()
|