guile-clipboard-speaker

Unnamed repository; edit this file 'description' to name the repository.
Log | Files | Refs | LICENSE

commit 6d6dfbd000620b79ef6c359b24dc6b47b9e11504
parent a59d743bcd373da739e6b518516df1f7ad8f48b7
Author: Yuval Langer <yuval.langer@gmail.com>
Date:   Sun, 18 Jun 2023 21:09:29 +0300

Add kill switch.

Diffstat:
Mclipboard-speaker.scm | 19+++++++++++++++++++
1 file changed, 19 insertions(+), 0 deletions(-)

diff --git a/clipboard-speaker.scm b/clipboard-speaker.scm @@ -79,6 +79,12 @@ (test integer?) (handler string->number)) (config:api:switch + (name 'kill) + (synopsis "Kill the espeak-ng loop process.") + (default #f) + (test boolean?) + (character #f)) + (config:api:switch (name 'clipboard-speaker-path) (synopsis "Path to the clipboard-speaker settings directory.") (default DEFAULT-CLIPBOARD-SPEAKER-HOME-PATH) @@ -226,6 +232,19 @@ options)) "clipboard-speaker")) + (when (config:option-ref options + 'kill) + (with-input-from-file (config:option-ref options + 'pid-file-path) + (lambda () + (let ([pid ((compose string->number + string-trim + get-string-all) + (current-input-port))]) + (format #t "Kill ~a\n" pid) + (kill pid SIGHUP) + (exit EXIT_SUCCESS))))) + ;; Make / open read and write fifo files. (define fifo-r+w (make-fifo-ports (config:option-ref options 'fifo-file-path)))