summaryrefslogtreecommitdiff
path: root/gnu
diff options
context:
space:
mode:
authorLudovic Courtès <ludo@gnu.org>2017-08-27 22:00:19 +0200
committerLudovic Courtès <ludo@gnu.org>2017-08-28 09:56:33 +0200
commit0a80981178ccf37a48474018929a8f338fb1cf4e (patch)
tree225c482adf01dda09a61bfebde83586bf8121cf6 /gnu
parent8bd5231485cdeb02078c4294badb3a1e7caa0fe0 (diff)
downloadpatches-0a80981178ccf37a48474018929a8f338fb1cf4e.tar
patches-0a80981178ccf37a48474018929a8f338fb1cf4e.tar.gz
marionette: Fix typing of capital letters.
Previously we'd use "sendkey P" instead of "sendkey shift-p", which had no effect. * gnu/build/marionette.scm (character->keystroke): New procedure. (string->keystroke-commands): Use it.
Diffstat (limited to 'gnu')
-rw-r--r--gnu/build/marionette.scm14
1 files changed, 11 insertions, 3 deletions
diff --git a/gnu/build/marionette.scm b/gnu/build/marionette.scm
index 789dab3ca0..d93525abb8 100644
--- a/gnu/build/marionette.scm
+++ b/gnu/build/marionette.scm
@@ -264,6 +264,14 @@ PREDICATE, whichever comes first. Raise an error when TIMEOUT is exceeded."
(#\bs . "backspace")
(#\tab . "tab")))
+(define (character->keystroke chr keystrokes)
+ "Return the keystroke for CHR according to the keyboard layout defined by
+KEYSTROKES."
+ (if (char-set-contains? char-set:upper-case chr)
+ (string-append "shift-" (string (char-downcase chr)))
+ (or (assoc-ref keystrokes chr)
+ (string chr))))
+
(define* (string->keystroke-commands str
#:optional
(keystrokes
@@ -272,9 +280,9 @@ PREDICATE, whichever comes first. Raise an error when TIMEOUT is exceeded."
to STR. KEYSTROKES is an alist specifying a mapping from characters to
keystrokes."
(string-fold-right (lambda (chr result)
- (cons (string-append "sendkey "
- (or (assoc-ref keystrokes chr)
- (string chr)))
+ (cons (string-append
+ "sendkey "
+ (character->keystroke chr keystrokes))
result))
'()
str))