Files
lhns--steam-frame-nix/modules/vr-keyboard/dictionary.nix
T
Pierre Kisters 5d15902ba1 Clearer file names and layout; docs/development.md
- steam-keyboard-patch.nix -> vr-keyboard-extra-keys.nix (option
  keyboard.vr.extraKeys), helper.mjs -> xdotool-helper.mjs;
  homeManagerModules.steam-keyboard-patch stays as an alias.
- vr-keyboard: panel.js/unpatch-panel.js/relay.mjs ->
  suggestions-panel/{patch,unpatch}.js + relay.mjs; decoder.js ->
  swipe-decoder.js; build.nix split into dictionary.nix and check.nix.
- modules/lib -> modules/steam-ui-patches/lib (the UI patch library).
- docs/development.md: repository layout (what runs where), runtime names.

Patch names, user services and state files are unchanged.
2026-09-29 01:42:34 +02:00

25 lines
1.0 KiB
Nix

# The VR keyboard's dictionary (vr-keyboard-dictionary.js, passed to patch.js;
# also used by check.nix), built by gen-dict.py from wordfreq frequency lists,
# filtered and cased by Hunspell. `dictionary`: the
# steamFrame.keyboard.vr.dictionary options.
{ pkgs, dictionary }:
let
d = dictionary;
in
pkgs.runCommand "vr-keyboard-dictionary.js" { } ''
${pkgs.python3.withPackages (ps: [ ps.wordfreq ])}/bin/python3 ${./gen-dict.py} $out ${pkgs.hunspell}/bin/hunspell \
${pkgs.writeText "vr-keyboard-dictionary.json" (builtins.toJSON {
languages = map (l: {
inherit (l) words keepFrequentAbove;
lang = l.language;
offset = l.frequencyOffset;
dict = if l.hunspell == null then null else "${pkgs.hunspellDicts.${l.hunspell}}/share/hunspell/${l.hunspell}";
}) d.languages;
extra = map (w: [ w d.extraWordsFrequency ]) d.extraWords;
extraFiles = map toString d.extraWordFiles;
extraZipf = d.extraWordsFrequency;
exclude = d.excludeWords;
inherit (d) contractions;
})}
''