From 0a80981178ccf37a48474018929a8f338fb1cf4e Mon Sep 17 00:00:00 2001 From: Ludovic Courtès Date: Sun, 27 Aug 2017 22:00:19 +0200 Subject: 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(-) (limited to 'gnu') 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 @@ (define %qwerty-us-keystrokes (#\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 @@ (define* (string->keystroke-commands str 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)) -- cgit v1.2.3