services: xorg: Add a 'keyboard-layout' field in <xorg-configuration>.
* gnu/services/xorg.scm (<xorg-configuration>)[keyboard-layout]: New field. (xorg-configuration->file)[input-class-section]: New procedure. Use it. * doc/guix.texi (X Window): Document 'keyboard-layout' field. Co-authored-by: nee <nee-git@hidamari.blue>
This commit is contained in:
parent
554b860739
commit
598757e038
|
@ -13374,6 +13374,15 @@ When @code{resolutions} is the empty list, Xorg chooses an appropriate screen
|
||||||
resolution. Otherwise, it must be a list of resolutions---e.g., @code{((1024
|
resolution. Otherwise, it must be a list of resolutions---e.g., @code{((1024
|
||||||
768) (640 480))}.
|
768) (640 480))}.
|
||||||
|
|
||||||
|
@cindex keyboard layout, for Xorg
|
||||||
|
@cindex keymap, for Xorg
|
||||||
|
@item @code{keyboard-layout} (default: @code{#f})
|
||||||
|
If this is @code{#f}, Xorg 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 in use when Xorg is running.
|
||||||
|
|
||||||
@item @code{extra-config} (default: @code{'()})
|
@item @code{extra-config} (default: @code{'()})
|
||||||
This is a list of strings or objects appended to the configuration file. It
|
This is a list of strings or objects appended to the configuration file. It
|
||||||
is used to pass extra text to be added verbatim to the configuration file.
|
is used to pass extra text to be added verbatim to the configuration file.
|
||||||
|
|
|
@ -25,6 +25,7 @@
|
||||||
#:use-module (gnu services)
|
#:use-module (gnu services)
|
||||||
#:use-module (gnu services shepherd)
|
#:use-module (gnu services shepherd)
|
||||||
#:use-module (gnu system pam)
|
#:use-module (gnu system pam)
|
||||||
|
#:use-module (gnu system keyboard)
|
||||||
#:use-module (gnu services dbus)
|
#:use-module (gnu services dbus)
|
||||||
#:use-module ((gnu packages base) #:select (canonical-package))
|
#:use-module ((gnu packages base) #:select (canonical-package))
|
||||||
#:use-module (gnu packages guile)
|
#:use-module (gnu packages guile)
|
||||||
|
@ -147,6 +148,8 @@
|
||||||
(default '()))
|
(default '()))
|
||||||
(resolutions xorg-configuration-resolutions ;list of tuples
|
(resolutions xorg-configuration-resolutions ;list of tuples
|
||||||
(default '()))
|
(default '()))
|
||||||
|
(keyboard-layout xorg-configuration-keyboard-layout ;#f | <keyboard-layout>
|
||||||
|
(default #f))
|
||||||
(extra-config xorg-configuration-extra-config ;list of strings
|
(extra-config xorg-configuration-extra-config ;list of strings
|
||||||
(default '()))
|
(default '()))
|
||||||
(server xorg-configuration-server ;package
|
(server xorg-configuration-server ;package
|
||||||
|
@ -195,6 +198,31 @@ Section \"Screen\"
|
||||||
EndSubSection
|
EndSubSection
|
||||||
EndSection"))
|
EndSection"))
|
||||||
|
|
||||||
|
(define (input-class-section layout variant model options)
|
||||||
|
(string-append "
|
||||||
|
Section \"InputClass\"
|
||||||
|
Identifier \"evdev keyboard catchall\"
|
||||||
|
MatchIsKeyboard \"on\"
|
||||||
|
Option \"XkbLayout\" " (object->string layout)
|
||||||
|
(if variant
|
||||||
|
(string-append " Option \"XkbVariant\" \""
|
||||||
|
variant "\"")
|
||||||
|
"")
|
||||||
|
(if model
|
||||||
|
(string-append " Option \"XkbModel\" \""
|
||||||
|
model "\"")
|
||||||
|
"")
|
||||||
|
(match options
|
||||||
|
(()
|
||||||
|
"")
|
||||||
|
(_
|
||||||
|
(string-append " Option \"XkbOptions\" \""
|
||||||
|
(string-join options ",") "\""))) "
|
||||||
|
|
||||||
|
MatchDevicePath \"/dev/input/event*\"
|
||||||
|
Driver \"evdev\"
|
||||||
|
EndSection\n"))
|
||||||
|
|
||||||
(define (expand modules)
|
(define (expand modules)
|
||||||
;; Append to MODULES the relevant /lib/xorg/modules
|
;; Append to MODULES the relevant /lib/xorg/modules
|
||||||
;; sub-directories.
|
;; sub-directories.
|
||||||
|
@ -240,6 +268,19 @@ EndSection\n" port)
|
||||||
port)
|
port)
|
||||||
(newline port)
|
(newline port)
|
||||||
|
|
||||||
|
(let ((layout #$(and=> (xorg-configuration-keyboard-layout config)
|
||||||
|
keyboard-layout-name))
|
||||||
|
(variant #$(and=> (xorg-configuration-keyboard-layout config)
|
||||||
|
keyboard-layout-variant))
|
||||||
|
(model #$(and=> (xorg-configuration-keyboard-layout config)
|
||||||
|
keyboard-layout-model))
|
||||||
|
(options '#$(keyboard-layout-options
|
||||||
|
(xorg-configuration-keyboard-layout config))))
|
||||||
|
(when layout
|
||||||
|
(display (input-class-section layout variant model options)
|
||||||
|
port)
|
||||||
|
(newline port)))
|
||||||
|
|
||||||
(for-each (lambda (config)
|
(for-each (lambda (config)
|
||||||
(display config port))
|
(display config port))
|
||||||
'#$(xorg-configuration-extra-config config))))))
|
'#$(xorg-configuration-extra-config config))))))
|
||||||
|
|
Loading…
Reference in New Issue