From f549c7604cb5df5e6656383f2272e92e59403e45 Mon Sep 17 00:00:00 2001 From: Hilton Chain Date: Wed, 14 Jan 2026 10:27:09 +0800 Subject: [PATCH] services: %rosenthal-set-keymap-script: Adapt to installer environment. This helps to invoke the script directly from Guix's installer. * modules/rosenthal/services/desktop.scm (%rosenthal-set-keymap-script): Output keymap to temporary file. Always change niri configuration. --- modules/rosenthal/services/desktop.scm | 27 +++++++++++++++----------- 1 file changed, 16 insertions(+), 11 deletions(-) diff --git a/modules/rosenthal/services/desktop.scm b/modules/rosenthal/services/desktop.scm index 8673942..3942c24 100644 --- a/modules/rosenthal/services/desktop.scm +++ b/modules/rosenthal/services/desktop.scm @@ -504,19 +504,24 @@ gtk-key-theme-name = ~a~%" (dump-port pipe output)))) (define* (set-keyboard-layout layout #:optional variant #:key model options) - (define file-name "/tmp/keymaps/console-keymap") + (define file-name (tmpnam)) (build-keyboard-layout file-name layout variant #:model model #:options options) (invoke "sudo" #$(file-append (spec->pkg "kbd") "/bin/loadkeys") file-name) - (when (getenv "WAYLAND_DISPLAY") - (substitute* (in-vicinity (getenv "XDG_CONFIG_HOME") "niri/config.kdl") - (("^ (layout|variant|model|options) .*") "") - (("^ xkb \\{.*" line) - (string-append - line - (format #f " layout ~s~%" layout) - (if variant (format #f " variant ~s~%" variant) "") - (if model (format #f " model ~s~%" model) "") - (format #f " options ~s~%" (string-join options ","))))))) + (false-if-exception + (substitute* + (in-vicinity + (if (zero? (getuid)) + "/home/live/.config" + (getenv "XDG_CONFIG_HOME")) + "niri/config.kdl") + (("^ (layout|variant|model|options) .*") "") + (("^ xkb \\{.*" line) + (string-append + line + (format #f " layout ~s~%" layout) + (if variant (format #f " variant ~s~%" variant) "") + (if model (format #f " model ~s~%" model) "") + (format #f " options ~s~%" (string-join options ","))))))) (define (show-help-and-exit) (display "\