mirror of
https://github.com/lhns/steam-frame-nix.git
synced 2026-10-06 01:00:13 +02:00
Small fixes: quiet service stops, duplicate scheme handlers, script nits
- session.services.stop: stop only units that are active; stopping a unit that isn't loaded printed "Failed to stop" on every switch (by default for steam-ui-patches, steam-keyboard-patch and vr-keyboard-relay). - keyring: a scheme in the schemeHandlers of two apps is an assertion instead of one app silently winning. - vr-keyboard-replay.mjs: recorded paths have no time; label them by index. - webpack-modules.mjs: skip page files that are missing instead of throwing.
This commit is contained in:
1 parent
b942352663
commit
36886d61df
4 files changed
+13
-5
No files matched your search
+5
-1
@@ -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;
|
||||
|
||||
+5
-1
@@ -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}
|
||||
'');
|
||||
|
||||
@@ -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)'}`);
|
||||
|
||||
@@ -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)) {
|
||||
|
||||
Reference in new issue
Block a user