commit 16e062d2f85c39a28364745b8048ef589425ff8f
parent 28a9929652633f718890b8dd994a1cb98ad2bba9
Author: Yuval Langer <yuval.langer@gmail.com>
Date: Wed, 7 Feb 2024 01:13:49 +0200
Change main repository, add mirror, use some standard procedures, use case-unfolded string comparison, and do some indentation.
Diffstat:
2 files changed, 25 insertions(+), 26 deletions(-)
diff --git a/README.md b/README.md
@@ -12,12 +12,12 @@ It basically reads whatever you mark with your mouse cursor.
## "Community":
-<irc://libera.chat/clipboard-speaker> (on the web:
-<https://web.libera.chat/#clipboard-speaker>).
+<irc://libera.chat/kakafarm> (on the web:
+<https://web.libera.chat/#kakafarm>)
## Code repositories:
-Main development repository is on <https://sr.ht/>:
+Main development repository is on <https://codeberg.org/>:
<https://codeberg.org/kakafarm/guile-clipboard-speaker/>
@@ -26,6 +26,7 @@ Mirrors:
- <https://git.sr.ht/~kakafarm/guile-clipboard-speaker/>
- <https://gitlab.com/yuvallangerontheroad/guile-clipboard-speaker/>
- <https://gitlab.com/yuvallanger/guile-clipboard-speaker/>
+- <https://kaka.farm/~stagit/guile-clipboard-speaker/log.html>
## Map your keybindings:
@@ -34,11 +35,9 @@ Mirrors:
Add the key bindings in (if you use Gnome. If you don't, look up how
to assign scripts to keybindings in your own window manager):
-#+begin_example
-Gnome Settings
- → Keyboard Shortcuts
- → All the way down and press the + button
-#+end_example
+ Gnome Settings
+ → Keyboard Shortcuts
+ → All the way down and press the + button
## Usage:
diff --git a/clipboard-speaker.scm b/clipboard-speaker.scm
@@ -5,6 +5,7 @@
(define-library (clipboard-speaker)
(import
(scheme base)
+ (scheme cxr)
(scheme process-context)
(scheme write)
@@ -17,11 +18,9 @@
LOCK_NB
O_NONBLOCK
SIGTERM
- cdadr
compose
fcntl
file-exists?
- filter
flock
force-output
format
@@ -43,6 +42,7 @@
waitpid
)
+ (srfi srfi-1)
(srfi srfi-11)
(srfi srfi-26)
(prefix (srfi srfi-180) json:)
@@ -101,15 +101,15 @@
(define (open-file-locked filename)
(let ([file-port (open-file filename "w")])
(with-exception-handler
- (lambda (an-exception)
- (close-port file-port)
- #f)
- (lambda ()
- (flock file-port
- (logior LOCK_EX
- LOCK_NB))
- file-port)
- #:unwind? #t)))
+ (lambda (an-exception)
+ (close-port file-port)
+ #f)
+ (lambda ()
+ (flock file-port
+ (logior LOCK_EX
+ LOCK_NB))
+ file-port)
+ #:unwind? #t)))
(define (get-home-directory)
(passwd:dir (getpw (getuid))))
@@ -144,9 +144,9 @@
(example "b/s/p (choose b or s or p)")
(default "b")
(test (lambda (x)
- (or (string-ci=? x "b")
- (string-ci=? x "s")
- (string-ci=? x "p"))))
+ (or (string=? x "b")
+ (string=? x "s")
+ (string=? x "p"))))
;;(handler identity)
)
(config:api:switch
@@ -336,13 +336,13 @@
;; If we receive a divine SIGTERM, kill our offsprings and commit
;; suicide. Truly, an Abrahamic horror story.
(sigaction SIGTERM
- (lambda (received-signal)
+ (lambda (received-signal)
;;; 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)))
+ (when (number? *espeak-ng-pid*)
+ (kill *espeak-ng-pid* received-signal))
+ (exit EXIT_SUCCESS)))
(espeak-loop fifo-r
(config:option-ref options 'words-per-minute)))