fix: do not play sounds on non-working periods

This commit is contained in:
Pavel Korytov 2021-11-10 13:27:37 +03:00
parent c7eef01fba
commit e26a8f9470

View file

@ -316,7 +316,7 @@ which can be played by `pomm-audio-player-executable'."
(setq pomm-audio-enabled nil)) (setq pomm-audio-enabled nil))
(when-let (sound (alist-get kind pomm-audio-files)) (when-let (sound (alist-get kind pomm-audio-files))
(start-process (start-process
"pomm audio player" "pomm-audio-player"
nil nil
pomm-audio-player-executable pomm-audio-player-executable
sound)))) sound))))
@ -327,8 +327,8 @@ which can be played by `pomm-audio-player-executable'."
((eq (alist-get 'status pomm--state) 'stopped) ((eq (alist-get 'status pomm--state) 'stopped)
(pomm--maybe-play-sound 'stop)) (pomm--maybe-play-sound 'stop))
((eq (alist-get 'status pomm--state) 'running) ((eq (alist-get 'status pomm--state) 'running)
(pomm--maybe-play-sound (alist-get 'kind (pomm--maybe-play-sound
(alist-get 'current pomm--state)))))) (alist-get 'kind (alist-get 'current pomm--state))))))
(defun pomm--dispatch-notification (kind) (defun pomm--dispatch-notification (kind)
"Dispatch a notification about a start of a period. "Dispatch a notification about a start of a period.
@ -441,7 +441,8 @@ The condition is: (effective-start-time + length) < now."
(when (pomm--need-switch-p) (when (pomm--need-switch-p)
(pomm--switch-to-next)) (pomm--switch-to-next))
(run-hooks 'pomm-on-tick-hook) (run-hooks 'pomm-on-tick-hook)
(pomm--maybe-play-sound 'tick))))) (when (eq (alist-get 'kind (alist-get 'current pomm--state)) 'work)
(pomm--maybe-play-sound 'tick))))))
(defun pomm--get-time-remaning () (defun pomm--get-time-remaning ()
"Get time remaining in the current pomodoro period. "Get time remaining in the current pomodoro period.