guile-clipboard-speaker

Accessibility tool that reads the contents of your clipboard buffer. Meant to be run with keybindings / shortcuts.
git clone https://kaka.farm/~git/guile-clipboard-speaker
Log | Files | Refs | README | LICENSE

commit 2b28fcaea2d53f150c8cd94c8d97da9a8f4f954c
parent 07a4a5906eef0e0c6c47b0d20f69cb32394da887
Author: Yuval Langer <yuval.langer@gmail.com>
Date:   Mon, 23 Dec 2024 17:59:52 +0200

Switch to `pipeline` from `spawn` and `pipe`.

Diffstat:
Mclipboard-speaker.scm | 23++++++++++-------------
1 file changed, 10 insertions(+), 13 deletions(-)

diff --git a/clipboard-speaker.scm b/clipboard-speaker.scm @@ -3,6 +3,8 @@ !# (define-library (clipboard-speaker) + (export main) + (import (scheme base) (scheme cxr) @@ -55,7 +57,6 @@ (prefix (config api) config:api:) (prefix (config licenses) config:licenses:) (prefix (config parser sexp) config:parser:sexp:)) - (export main) (begin (define *espeak-ng-pid* #f) @@ -246,28 +247,24 @@ (values fifo-port-read fifo-port-write))) (define (espeak-loop fifo-read-port words-per-minute) - (let ((espeak-ng-input-pipe (pipe))) - (set! *espeak-ng-pid* - (spawn "espeak-ng" - (list "espeak-ng" - "-s" - (number->string words-per-minute)) - #:input (car espeak-ng-input-pipe))) + (let-values (((from-espeak-ng to-espeak-ng pipeline-pids) + (pipeline (list (list "espeak-ng" + "-s" + (number->string words-per-minute)))))) + (set! *espeak-ng-pid* (match-let (((pid) pipeline-pids)) pid)) (let loop ((text-to-speak (get-line fifo-read-port))) (format #t "Server received: ~A\n" text-to-speak) - (put-string (cdr espeak-ng-input-pipe) - text-to-speak) + (put-string to-espeak-ng text-to-speak) ;; XXX: These ports are line buffered(?). Always write to ports ;; with a newline at their end if you want the other side to read ;; them now. - (put-char (cdr espeak-ng-input-pipe) - #\newline) + (put-char to-espeak-ng #\newline) ;; XXX: You also have you flush the port, otherwise the TTS keeps ;; silent. Please someone explain this to me. - (force-output (cdr espeak-ng-input-pipe)) + (force-output to-espeak-ng) (loop (get-line fifo-read-port)))))