Refactor pomodoro module

Replace `subprocess` call with built-in module for sending
desktop notifications.
This commit is contained in:
Sergei Turukin 2016-11-06 13:21:39 +03:00
parent 1d1491c6a3
commit 4f7d5673c0

View File

@ -1,6 +1,7 @@
import subprocess import subprocess
from datetime import datetime, timedelta from datetime import datetime, timedelta
from i3pystatus import IntervalModule from i3pystatus import IntervalModule
from i3pystatus.core.desktop import DesktopNotification
STOPPED = 0 STOPPED = 0
@ -100,9 +101,9 @@ class Pomodoro(IntervalModule):
self.time = None self.time = None
def _alarm(self, text): def _alarm(self, text):
subprocess.call(['notify-send', notification = DesktopNotification('Alarm!', text)
'Alarm!', notification.display()
text])
subprocess.Popen(['aplay', subprocess.Popen(['aplay',
self.sound, self.sound,
'-q'], '-q'],