diff --git a/modules/keyring.nix b/modules/keyring.nix index 1fb6104..b07db7c 100644 --- a/modules/keyring.nix +++ b/modules/keyring.nix @@ -246,7 +246,11 @@ in { assertions = map (id: { assertion = false; message = "steamFrame.keyring: \"${id}\" is in both flatpaks and programs."; - }) (lib.intersectLists (lib.attrNames cfg.flatpaks) (lib.attrNames cfg.programs)); + }) (lib.intersectLists (lib.attrNames cfg.flatpaks) (lib.attrNames cfg.programs)) + ++ lib.mapAttrsToList (mime: ids: { + assertion = lib.length ids == 1; + message = "steamFrame.keyring: ${lib.removePrefix "x-scheme-handler/" mime} is in the schemeHandlers of ${lib.concatStringsSep " and " ids}."; + }) (lib.zipAttrs (map (h: { ${h.name} = lib.removeSuffix ".desktop" h.value; }) handlers)); xdg.dataFile = lib.mapAttrs' (id: app: lib.nameValuePair "applications/${id}.desktop" { text = entry id app; }) apps; diff --git a/modules/session.nix b/modules/session.nix index 2a18b4c..f66f8bb 100644 --- a/modules/session.nix +++ b/modules/session.nix @@ -95,7 +95,11 @@ in { '' + lib.optionalString (cfg.services.start != [ ]) '' run /usr/bin/systemctl --user start ${units cfg.services.start} '' + lib.optionalString (cfg.services.stop != [ ]) '' - run /usr/bin/systemctl --user stop ${units cfg.services.stop} || true + # Skip inactive ones: stopping a unit that isn't loaded fails noisily. + for unit in ${units cfg.services.stop}; do + [[ $(/usr/bin/systemctl --user show -p ActiveState --value "$unit") == inactive ]] \ + || run /usr/bin/systemctl --user stop "$unit" || true + done '' + lib.optionalString (cfg.services.restart != [ ]) '' run /usr/bin/systemctl --user restart ${units cfg.services.restart} ''); diff --git a/scripts/vr-keyboard-replay.mjs b/scripts/vr-keyboard-replay.mjs index 3cd93bf..4a9130e 100644 --- a/scripts/vr-keyboard-replay.mjs +++ b/scripts/vr-keyboard-replay.mjs @@ -6,10 +6,10 @@ import { readFileSync } from 'node:fs'; const [, , decoderPath, dictPath, pathsPath, expected] = process.argv; const D = (0, eval)(readFileSync(decoderPath, 'utf8')); const dict = D.parseDict(JSON.parse(readFileSync(dictPath, 'utf8'))); -for (const p of JSON.parse(readFileSync(pathsPath, 'utf8'))) { +for (const [i, p] of JSON.parse(readFileSync(pathsPath, 'utf8')).entries()) { const lay = D.layout(dict, p.keys, p.unit); const res = D.decode(lay, p.pts, { unit: p.unit, max: 8 }); - console.log(`${p.t}: recorded ${p.top.join(' ')}\n now ${res.map((r) => `${r.word} ${r.cost.toFixed(2)}`).join(', ')}`); + console.log(`#${i}: recorded ${p.top.join(' ')}\n now ${res.map((r) => `${r.word} ${r.cost.toFixed(2)}`).join(', ')}`); if (expected) { const f = D.decode(lay, p.pts, { unit: p.unit, features: true }).find((x) => x.word === expected); console.log(` ${expected}: ${f ? JSON.stringify(f.f) : 'pruned (start/end key or a letter too far from the path)'}`); diff --git a/scripts/webpack-modules.mjs b/scripts/webpack-modules.mjs index 4b937ce..752c351 100644 --- a/scripts/webpack-modules.mjs +++ b/scripts/webpack-modules.mjs @@ -149,7 +149,7 @@ export function loadBundles(dir, { files, exclude } = {}) { for (const f of files) { if (exclude?.test(f)) continue; const p = join(dir, f); - if (!statSync(p).isFile()) continue; + if (!statSync(p, { throwIfNoEntry: false })?.isFile()) continue; // listed by the page but missing const src = readFileSync(p, 'utf8'); if (!/webpackChunk|[\w$]=\{\d+:/.test(src)) continue; for (const m of extractModules(src)) {