commit 3556fd0210ab15479c69445122f6a7df223635f0
parent 134cc7178f64c7d197bd8d7d5fe57e1dbf7457d3
Author: Yuval Langer <yuval.langer@gmail.com>
Date: Sat, 24 Jun 2023 14:59:31 +0300
Fix a Gnome keybindings / shortcuts listening service killing bug.
Diffstat:
1 file changed, 15 insertions(+), 14 deletions(-)
diff --git a/clipboard-speaker.scm b/clipboard-speaker.scm
@@ -18,6 +18,9 @@
)
+(define espeak-ng-pid #f)
+
+
(define (dp x)
;; Debug print.
(display x) (newline))
@@ -210,17 +213,6 @@
xsel-output)
-
-(define* (espeak-ng-speak text-to-speak words-per-minute)
- (define espeak-ng-process-pid
- (spawn "espeak-ng" `("espeak-ng"
- "-s"
- ,(number->string words-per-minute)
- ,text-to-speak)))
-
- espeak-ng-process-pid)
-
-
(define (make-fifo-ports fifo-file-path)
(when (not (file-exists? fifo-file-path))
(mkfifo fifo-file-path
@@ -249,11 +241,16 @@
(string-append (get-line fifo-read-port)
"\n"))
- (define espeak-ng-pid (espeak-ng-speak text-to-speak
- words-per-minute))
+ (set! espeak-ng-pid
+ (spawn "espeak-ng" `("espeak-ng"
+ "-s"
+ ,(number->string words-per-minute)
+ ,text-to-speak)))
(waitpid espeak-ng-pid)
+ (set! espeak-ng-pid #f)
+
(espeak-loop fifo-read-port
words-per-minute))
@@ -319,7 +316,11 @@
;; suicide. Truly, an Abrahamic horror story.
(sigaction SIGTERM
(lambda (received-signal)
- (kill 0 received-signal) ;; Kill all processes in our group.
+;;; XXX: BUG: In Gnome, (kill 0 received-signal), which kills all
+;;; processes in our group, results in killing the keybinding reading
+;;; process that runs clipboard-speaker, hence espeak-ng-pid.
+ (when (number? espeak-ng-pid)
+ (kill espeak-ng-pid received-signal))
(exit EXIT_SUCCESS)))
(espeak-loop (car fifo-r+w)