[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
04/06: marionette: Fix typing of capital letters.
From: |
Ludovic Courtès |
Subject: |
04/06: marionette: Fix typing of capital letters. |
Date: |
Mon, 28 Aug 2017 04:19:07 -0400 (EDT) |
civodul pushed a commit to branch master
in repository guix.
commit 0a80981178ccf37a48474018929a8f338fb1cf4e
Author: Ludovic Courtès <address@hidden>
Date: Sun Aug 27 22:00:19 2017 +0200
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.
---
gnu/build/marionette.scm | 14 +++++++++++---
1 file changed, 11 insertions(+), 3 deletions(-)
diff --git a/gnu/build/marionette.scm b/gnu/build/marionette.scm
index 789dab3..d93525a 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))
- branch master updated (15d6148 -> 7f09020), Ludovic Courtès, 2017/08/28
- 01/06: bootloader: Emit warnings with 'warning'., Ludovic Courtès, 2017/08/28
- 03/06: marionette: 'wait-for-file' really raises an error when a file is missing., Ludovic Courtès, 2017/08/28
- 05/06: marionette: Augment the set of keystrokes., Ludovic Courtès, 2017/08/28
- 02/06: gnu: emacs-nix-mode: Move to package-management.scm., Ludovic Courtès, 2017/08/28
- 06/06: services: user-processes: Reap child processes., Ludovic Courtès, 2017/08/28
- 04/06: marionette: Fix typing of capital letters.,
Ludovic Courtès <=