On my previous OS I had created my own custom keyboard-layout, to which I even added it as a new (constructed) language, mostly so that I could more easily use diacritics in case I want to type in another European language, but also create my own attempt at a unified EU language that’s not bound to qwerty or dependent on the US.
I created files and a script that would do the following:
00-keyboard.conf copied to /etc/X11/xorg.conf.d
yr copied to /usr/share/X11/xkb/symbols
yr-af.map.gz copied to /usr/share/kbd/keymaps/i386/dvorak
KEYMAP=yr-af copied to /etc/vconsole.conf
yrdev.xml inserted into <layoutList> of usr/share/X11/xkb/rues/evdev.xml`
That explains that the xkeyboard-config package contains all the keyboard configurations and that /run/current-system/profile/share/keymaps folder contains the available keymaps used.
Unfortunately, I seem to have have two xkeyboard-config folders in /gnu/store with the same version and I’m not sure why that is, but I think it’s related to another issue I have.
So for users that still use X11, I created some dotfiles like this:
(define-module (config services home layout-european-xkb)
#:use-module (gnu home services)
#:use-module (guix gexp)
#:export (service-user-layout-european-xkb))
;; 1. The script that activates the layout
(define activate-layout-xkb
(plain-file "activate-layout-xkb.sh"
"#!/bin/sh
# Activate the European layout only if we're in a graphical session
if [ -n \"$DISPLAY\" ]; then
setxkbmap -print | sed 's/xkb_symbols.*/xkb_symbols { include \"pc+yr(aoi)+inet(evdev)\" };/' | xkbcomp -I$HOME/.local/share/xkb - $DISPLAY >> /tmp/activation-desktop-xkb.log 2>&1
fi"))
;; 2. The .desktop file for XFCE autostart
(define activation-desktop-xkb
(plain-file "activate-layout-european-xkb.desktop"
"[Desktop Entry]
Type=Application
Name=Activate European Keyboard
Exec=sh /home/folaht/.local/bin/activate-layout-xkb.sh
Terminal=false
X-GNOME-Autostart-enabled=true"))
;; 3. The service that brings everything together
;; Note: adjust the path to your 'yr' file if it's located elsewhere than config/xkb/yr
(define service-user-layout-european-xkb
;; Place the XKB file and the script
(simple-service 'xkb-european-file
home-files-service-type
`((".local/share/xkb/symbols/yr" ,(local-file "../../files/keyboard/yr" "yr"))
(".local/bin/activate-layout-xkb.sh" ,activate-layout-xkb)
(".config/autostart/activate-layout-european-xkb.desktop" ,activation-desktop-xkb))))