Working sound

This commit is contained in:
Abhorrent_Anger 2019-10-21 14:14:15 +03:00 committed by Mārtiņš Kurmis
parent 88366f4fe2
commit 8880af7215
1 changed files with 7 additions and 4 deletions

11
main.py Normal file → Executable file
View File

@ -1,7 +1,8 @@
#!/usr/bin/python3 #!/usr/bin/python3
import notify2 import notify2
import gtk
from time import sleep from time import sleep
#from playsound import playsound from playsound import playsound
NAME = 'Eye Strain Reminder' NAME = 'Eye Strain Reminder'
MESSAGE = 'Friendly reminder to observe the 20-20-20 rule' MESSAGE = 'Friendly reminder to observe the 20-20-20 rule'
@ -15,14 +16,16 @@ def uninit():
notify2.uninit() notify2.uninit()
def send_notification(): def send_notification():
#playsound('files/default.mp3') notification = notify2.Notification(NAME, MESSAGE, "notification-device-eject")
notification = notify2.Notification(NAME, MESSAGE)
#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_timeout(TIMEOUT * MILLISECOND)
notification.set_urgency(notify2.URGENCY_LOW) notification.set_urgency(notify2.URGENCY_LOW)
notification.show() notification.show()
playsound('files/default.wav')
sleep(TIMEOUT) sleep(TIMEOUT)
notification.close() notification.close()
#playsound('files/default.mp3') playsound('files/default.wav')
if __name__ == '__main__': if __name__ == '__main__':
init() init()