unofficial mirror of guix-patches@gnu.org 
 help / color / mirror / code / Atom feed
From: luhui <luhuins@163.com>
To: Mathieu Othacehe <othacehe@gnu.org>
Cc: 47994@debbugs.gnu.org, luhui <luhuins@163.com>,
	Maxime Devos <maximedevos@telenet.be>
Subject: [bug#47994] [PATCH] services: kmscon: Add xkb-layout and xkb-options fields.
Date: Mon, 21 Jun 2021 23:28:34 +0800	[thread overview]
Message-ID: <YNCwInojQDzA+IOG@thinkpad-x230-luhui> (raw)
In-Reply-To: <87bl8lerbe.fsf_-_@gnu.org>

[-- Attachment #1: Type: text/plain, Size: 339 bytes --]

On Fri, Jun 04, 2021 at 02:40:21PM +0200, Mathieu Othacehe wrote:
> 
> Hello,
> 
> > +                       ,@(if variant `("--xkb-layout" ,variant) '())
> 
> This is supposed to be "--xkb-variant" here, right?

Sorry, made this mistake, now I fixed it and sent a new patch.

> 
> Otherwise, it looks good to me.
> 
> Thanks,
> 
> Mathieu

[-- Attachment #2: 0001-services-kmscon-Add-keyboard-layout-fields.patch --]
[-- Type: text/plain, Size: 4564 bytes --]

From 310ff049da9e6ea7f0556430b0b51580a675d696 Mon Sep 17 00:00:00 2001
From: luhui <luhuins@163.com>
Date: Mon, 21 Jun 2021 22:58:06 +0800
Subject: [PATCH] services: kmscon: Add keyboard-layout fields.

* gnu/services/base.scm (<kmscon-configuration>): Add keyboard-layout fields.
* doc/guix.texi (Base Services): Document it.
---
 doc/guix.texi         |  9 +++++++++
 gnu/services/base.scm | 21 +++++++++++++++++++--
 2 files changed, 28 insertions(+), 2 deletions(-)

diff --git a/doc/guix.texi b/doc/guix.texi
index 66c6adc4f5..eb151a56fb 100644
--- a/doc/guix.texi
+++ b/doc/guix.texi
@@ -91,6 +91,7 @@ Copyright @copyright{} 2020 Edgar Vincent@*
 Copyright @copyright{} 2021 Maxime Devos@*
 Copyright @copyright{} 2021 B. Wilson@*
 Copyright @copyright{} 2021 Xinglu Chen@*
+Copyright @copyright{} 2021 Hui Lu@*
 
 Permission is granted to copy, distribute and/or modify this document
 under the terms of the GNU Free Documentation License, Version 1.3 or
@@ -15280,6 +15281,14 @@ Font engine used in Kmscon.
 @item @code{font-size} (default: @code{12})
 Font size used in Kmscon.
 
+@item @code{keyboard-layout} (default: @code{#f})
+If this is @code{#f}, Kmscon uses the default keyboard layout---usually US
+English (``qwerty'') for a 105-key PC keyboard.
+
+Otherwise this must be a @code{keyboard-layout} object specifying the keyboard
+layout. @xref{Keyboard Layout}, for more information on how to specify the
+keyboard layout.
+
 @item @code{kmscon} (default: @var{kmscon})
 The Kmscon package to use.
 
diff --git a/gnu/services/base.scm b/gnu/services/base.scm
index 3be2e984c3..6922d7f90b 100644
--- a/gnu/services/base.scm
+++ b/gnu/services/base.scm
@@ -14,6 +14,7 @@
 ;;; Copyright © 2020 Florian Pelz <pelzflorian@pelzflorian.de>
 ;;; Copyright © 2020 Brice Waegeneire <brice@waegenei.re>
 ;;; Copyright © 2021 qblade <qblade@protonmail.com>
+;;; Copyright © 2021 Hui Lu <luhuins@163.com>
 ;;;
 ;;; This file is part of GNU Guix.
 ;;;
@@ -41,6 +42,7 @@
   #:use-module (gnu system shadow)                ; 'user-account', etc.
   #:use-module (gnu system uuid)
   #:use-module (gnu system file-systems)          ; 'file-system', etc.
+  #:use-module (gnu system keyboard)
   #:use-module (gnu system mapped-devices)
   #:use-module ((gnu system linux-initrd)
                 #:select (file-system-packages))
@@ -2267,7 +2269,9 @@ notably to select, copy, and paste text.  The default options use the
   (font-engine             kmscon-configuration-font-engine
                            (default "pango"))
   (font-size               kmscon-configuration-font-size
-                           (default 12)))
+                           (default 12))
+  (keyboard-layout         kmscon-configuration-keyboard-layout
+                           (default #f))) ; #f | <keyboard-layout>
 
 (define kmscon-service-type
   (shepherd-service-type
@@ -2280,7 +2284,8 @@ notably to select, copy, and paste text.  The default options use the
            (auto-login (kmscon-configuration-auto-login config))
            (hardware-acceleration? (kmscon-configuration-hardware-acceleration? config))
            (font-engine (kmscon-configuration-font-engine config))
-           (font-size (kmscon-configuration-font-size config)))
+           (font-size (kmscon-configuration-font-size config))
+           (keyboard-layout (kmscon-configuration-keyboard-layout config)))
 
        (define kmscon-command
          #~(list
@@ -2289,6 +2294,18 @@ notably to select, copy, and paste text.  The default options use the
             "--no-switchvt" ;Prevent a switch to the virtual terminal.
             "--font-engine" #$font-engine
             "--font-size" #$(number->string font-size)
+            #$@(if keyboard-layout
+                   (let* ((layout (keyboard-layout-name keyboard-layout))
+                          (variant (keyboard-layout-variant keyboard-layout))
+                          (model (keyboard-layout-model keyboard-layout))
+                          (options (keyboard-layout-options keyboard-layout)))
+                     `("--xkb-layout" ,layout
+                       ,@(if variant `("--xkb-variant" ,variant) '())
+                       ,@(if model `("--xkb-model" ,model) '())
+                       ,@(if (null? options)
+                             '()
+                             `("--xkb-options" ,(string-join options ",")))))
+                   '())
             #$@(if hardware-acceleration? '("--hwaccel") '())
             "--login" "--"
             #$login-program #$@login-arguments
-- 
2.32.0


  reply	other threads:[~2021-06-21 15:28 UTC|newest]

Thread overview: 10+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2021-04-24  5:37 [bug#47994] [PATCH] services: kmscon: Add xkb-layout and xkb-options fields luhui
2021-04-25  9:12 ` Maxime Devos
2021-04-25 10:04   ` luhui
2021-04-25 12:46     ` Maxime Devos
2021-04-26  2:07       ` luhui
2021-04-26 19:23         ` Maxime Devos
2021-05-04 11:32           ` luhui
2021-06-04 12:40         ` Mathieu Othacehe
2021-06-21 15:28           ` luhui [this message]
2021-06-29 17:02             ` bug#47994: " Mathieu Othacehe

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

  List information: https://guix.gnu.org/

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=YNCwInojQDzA+IOG@thinkpad-x230-luhui \
    --to=luhuins@163.com \
    --cc=47994@debbugs.gnu.org \
    --cc=maximedevos@telenet.be \
    --cc=othacehe@gnu.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
Code repositories for project(s) associated with this public inbox

	https://git.savannah.gnu.org/cgit/guix.git

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).