From 2688d3d9ad0da78ad4396bb5a467bcf4d9444c84 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Kier=C3=A1n=20Meinhardt?= Date: Thu, 25 Dec 2025 18:23:27 +0100 Subject: [PATCH] keyboard: set and use extraLayouts --- README.md | 2 +- configs/keyboard/default.nix | 56 +++++++++++++++++------------------- 2 files changed, 28 insertions(+), 30 deletions(-) diff --git a/README.md b/README.md index d22116b..c78b2f6 100644 --- a/README.md +++ b/README.md @@ -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` diff --git a/configs/keyboard/default.nix b/configs/keyboard/default.nix index e9f68b0..b48fd0c 100644 --- a/configs/keyboard/default.nix +++ b/configs/keyboard/default.nix @@ -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";