1
0
mirror of https://github.com/kmein/niveum synced 2026-03-16 10:11:08 +01:00

keyboard: set and use extraLayouts

This commit is contained in:
2025-12-25 18:23:27 +01:00
parent 98efafb738
commit 2688d3d9ad
2 changed files with 28 additions and 30 deletions

View File

@@ -14,4 +14,4 @@
> Deine Configs sind wunderschön <3 —[flxai](https://github.com/flxai/)
## To do
- [ ] `services.xserver.xkb.extraLayouts`
- [ ] get rid of `nixinate`

View File

@@ -1,4 +1,5 @@
{
config,
pkgs,
lib,
...
@@ -63,45 +64,42 @@ in
# man 7 xkeyboard-config
services.xserver = {
exportConfiguration = true; # link /usr/share/X11 properly
exportConfiguration = lib.mkForce true; # link /usr/share/X11 properly
xkb.layout = defaultLanguage.code;
# T3: https://upload.wikimedia.org/wikipedia/commons/a/a9/German-Keyboard-Layout-T3-Version1-large.png
# buckwalter: http://www.qamus.org/transliteration.htm
xkb.variant = defaultLanguage.variant;
xkb.options = commaSep xkbOptions;
xkb.dir = pkgs.symlinkJoin {
name = "x-keyboard-directory";
paths = [
"${pkgs.xkeyboard_config}/etc/X11/xkb"
(pkgs.linkFarm "custom-x-keyboards" (
lib.mapAttrsToList (name: value: {
name = "symbols/${name}";
path = value;
}) (lib.filterAttrs (_: value: !(value ? "code")) languages)
++ [
{
name = "symbols/ir";
path = ./farsi;
}
]
))
];
xkb.extraLayouts = {
coptic = {
languages = [ "cop" ];
description = "Coptic is the latest stage of the Egyptian language and was used by Egyptian Christians. The Coptic script is based on the Greek alphabet with some letters borrowed from Demotic Egyptian.";
symbolsFile = ./coptic;
};
avestan = {
languages = [ "ave" ];
description = "Avestan is an ancient Iranian language known primarily from its use in the sacred texts of Zoroastrianism, the Avesta. It is an Indo-Iranian language that was spoken in ancient Persia.";
symbolsFile = ./avestan;
};
gothic = {
languages = [ "got" ];
description = "Gothic is an extinct East Germanic language that was spoken by the Goths. It is known primarily from the Codex Argenteus, a 6th-century manuscript containing a translation of the Bible into Gothic.";
symbolsFile = ./gothic;
};
farsi = {
languages = [ "fas" ];
description = "Farsi, also known as Persian, is an Indo-Iranian language spoken primarily in Iran, Afghanistan (where it is known as Dari), and Tajikistan (where it is called Tajik). It has a rich literary tradition and is written in a modified Arabic script.";
symbolsFile = ./farsi;
};
};
};
environment.etc."x11-locale".source = toString pkgs.xorg.libX11 + "share/X11/locale";
home-manager.users.me = {
home.file =
lib.mapAttrs' (name: path: lib.nameValuePair ".xkb/symbols/${name}" { source = path; }) (
lib.filterAttrs (_: value: !(value ? "code")) languages
)
// {
".xkb/symbols/ir".source = ./farsi;
}
// {
".XCompose".source = ./XCompose;
};
home.file = {
".XCompose".source = ./XCompose;
};
};
console.keyMap = "de";
@@ -123,7 +121,7 @@ in
swaymsg -s $SWAYSOCK 'input * xkb_options "${lib.concatStringsSep "," xkbOptions}"'
fi
''
) languages;
) (languages // config.services.xserver.xkb.extraLayouts);
# improve held key rate
services.xserver.displayManager.sessionCommands = "${pkgs.xorg.xset}/bin/xset r rate 300 50";