mirror of
https://codeberg.org/hako/Rosenthal.git
synced 2025-07-07 00:55:48 +00:00
services: Add home-keyboard-service-type from RDE.
* rosenthal/services/keyboard.scm: New file.
This commit is contained in:
parent
5172fac369
commit
fbcf6a1d7d
28
rosenthal/services/keyboard.scm
Normal file
28
rosenthal/services/keyboard.scm
Normal file
@ -0,0 +1,28 @@
|
|||||||
|
;;; SPDX-FileCopyrightText: 2021 Andrew Tropin <andrew@trop.in>
|
||||||
|
;;;
|
||||||
|
;;; SPDX-License-Identifier: GPL-3.0-or-later
|
||||||
|
|
||||||
|
(define-module (rosenthal services keyboard)
|
||||||
|
#:use-module (gnu system keyboard)
|
||||||
|
#:use-module (gnu home services)
|
||||||
|
#:export (home-keyboard-service-type))
|
||||||
|
|
||||||
|
(define (set-xkb-variables layout)
|
||||||
|
(if layout
|
||||||
|
`(("XKB_DEFAULT_LAYOUT" . ,(keyboard-layout-name layout))
|
||||||
|
("XKB_DEFAULT_VARIANT" . ,(keyboard-layout-variant layout))
|
||||||
|
("XKB_DEFAULT_OPTIONS" . ,(string-join
|
||||||
|
(keyboard-layout-options layout) ","))
|
||||||
|
("XKB_DEFAULT_MODEL" . ,(keyboard-layout-model layout)))
|
||||||
|
'()))
|
||||||
|
|
||||||
|
(define home-keyboard-service-type
|
||||||
|
(service-type (name 'home-keyboard)
|
||||||
|
(extensions
|
||||||
|
(list (service-extension
|
||||||
|
home-environment-variables-service-type
|
||||||
|
set-xkb-variables)))
|
||||||
|
(default-value #f)
|
||||||
|
(description "Set layouts by configuring XKB_*
|
||||||
|
environment variables. Service accepts an instance of
|
||||||
|
@code{keyboard-layout} from @code{(gnu system keyboard)}.")))
|
Loading…
Reference in New Issue
Block a user