mirror of
https://github.com/lhns/steam-frame-nix.git
synced 2026-10-06 03:00:13 +02:00
Trim: firefox launcher, debugger-arm migration, comments and docs
- firefox: the prefs.js patterns built once; the extension link condition without the redundant desktopFix (it implies a pref). - install.sh steamvr-debugger-arm: no second copy of the old-marker migration (cleanup, run on every switch before the arm unit exists, already does it). - steam-ui-patches: shorter state option description; lib's description mentions extraArgs. - README: uiPatches.patches fields in the options table (moved from docs/ui-patches.md); docs/ui-patches.md: the finder helpers; docs/steamvr-debugger.md: repeated sentences removed.
This commit is contained in:
1 parent
a5ecbad76d
commit
b3d93e8526
8 files changed
+43
-69
No files matched your search
@@ -203,11 +203,9 @@ pkgs.runCommand "cleanup-check" { nativeBuildInputs = [ cleanup pkgs.jq ]; } ''
|
||||
arm() { bash ${../../install.sh} steamvr-debugger-arm; }
|
||||
fresh e
|
||||
printf '{\n "steamvr" : {}\n}\n' > $V
|
||||
touch $S/steamvr-debugger # old marker: migrated
|
||||
echo activating > $STUB/state
|
||||
res=$(arm); echo "$res"
|
||||
[ "$(cat $S/steamvr-debugger.armed)" = absent ] || fail "armed"
|
||||
gone $S/steamvr-debugger
|
||||
[ "$(jq -c .VRWebHelper $V)" = '{"DebuggerEnabled":true}' ] || fail "arm: $(cat $V)"
|
||||
there $root/run/steam-frame-nix/steamvr-debugger-restore
|
||||
[ "$(grep -c daemon-reload $STUB/log)" = 1 ] || fail "arm reload"
|
||||
|
||||
+10
-17
@@ -1,25 +1,18 @@
|
||||
# Firefox Flatpak (org.mozilla.firefox) launcher.
|
||||
# - prefs and vrFullscreenFix are default prefs (pref(), the default branch:
|
||||
# never written to prefs.js, so removing one leaves nothing behind). Firefox
|
||||
# reads defaults/pref/*.js from its system config dir, /app/etc/firefox in
|
||||
# the Flatpak, the mount point of the org.mozilla.firefox.systemconfig
|
||||
# extension. The user installation's "unmaintained extension" dir
|
||||
# ($XDG_DATA_HOME/flatpak/extension/<id>/<arch>/<branch>) provides it: a
|
||||
# home-manager link to a store dir, which Flatpak mounts itself (the
|
||||
# sandbox needn't see /nix).
|
||||
# - prefs and vrFullscreenFix are default prefs (pref(): never written to
|
||||
# prefs.js, so removing one leaves nothing behind) in defaults/pref/ of the
|
||||
# org.mozilla.firefox.systemconfig extension (/app/etc/firefox), provided
|
||||
# as the user installation's "unmaintained extension"
|
||||
# ($XDG_DATA_HOME/flatpak/extension/<id>/<arch>/<branch>): a Home Manager
|
||||
# link to a store dir, which Flatpak mounts itself (the sandbox needn't see
|
||||
# /nix).
|
||||
# - vrFullscreenFix: in the Steam session gamescope focuses a fullscreen X11
|
||||
# window but never shows it (Firefox looks frozen). ignore-widgets keeps
|
||||
# fullscreen inside the window.
|
||||
# - desktopProfile: the sessions have separate buses/displays, so a second
|
||||
# Firefox can't reach the running one and hits the profile lock; the nested
|
||||
# desktop gets its own profile (a normal Firefox profile: browser data).
|
||||
# Fullscreen works there, so the launcher undoes the fix in that profile
|
||||
# only while its Firefox runs: a user.js link to the extension's
|
||||
# steam-frame-nix-desktop-user.js (a sandbox path; dangling on the host),
|
||||
# made right before Firefox starts and removed, with the value Firefox
|
||||
# stored from it in prefs.js, once it has exited (firefox/launcher.nix).
|
||||
# Leftovers (a crash) and what older versions wrote into profiles (user.js
|
||||
# copies and links) are removed by steam-frame-nix-cleanup (on switch).
|
||||
# desktop gets its own profile, where fullscreen works: the launcher undoes
|
||||
# the fix there while its Firefox runs (firefox/launcher.nix).
|
||||
# The entry shadows the Flatpak's (same ID), keeping MIME associations, and is
|
||||
# seen by the "+" menu (which reads only ~/.local/share/applications).
|
||||
# defaultBrowser: without a default the portal picks the first installed
|
||||
@@ -122,7 +115,7 @@ in {
|
||||
|
||||
# stable: the branch the launcher runs (the extension point has no
|
||||
# version, so it takes the app's branch).
|
||||
xdg.dataFile = lib.optionalAttrs (defaultPrefs != { } || desktopFix) {
|
||||
xdg.dataFile = lib.optionalAttrs (defaultPrefs != { }) { # desktopFix implies a pref
|
||||
"flatpak/extension/org.mozilla.firefox.systemconfig/aarch64/stable".source = sysconfig;
|
||||
} // {
|
||||
"applications/org.mozilla.firefox.desktop".text = ''
|
||||
|
||||
@@ -26,14 +26,15 @@ writeShellScript "firefox-launcher" (''
|
||||
'' + lib.optionalString desktopFix ''
|
||||
js=${lib.escapeShellArg desktopJs}
|
||||
u=$prof/user.js
|
||||
pats=${lib.escapeShellArg (lib.concatMapStringsSep "\n" (k: "user_pref(${builtins.toJSON k},") desktopKeys)}
|
||||
# Firefox holds .parentlock open while it uses a profile (the sandbox sees
|
||||
# the profile at the same path).
|
||||
inUse() { find /proc/[0-9]*/fd -lname "$prof/.parentlock" -print -quit 2>/dev/null | grep -q .; }
|
||||
ours() { [ -L "$u" ] && [ "$(readlink "$u")" = "$js" ]; }
|
||||
sfn_unlink() {
|
||||
ours && ! inUse || return 0
|
||||
if [ -f "$prof/prefs.js" ] && grep -qF -f <(printf '%s\n' ${lib.escapeShellArgs (map (k: "user_pref(${builtins.toJSON k},") desktopKeys)}) "$prof/prefs.js"; then
|
||||
grep -vF -f <(printf '%s\n' ${lib.escapeShellArgs (map (k: "user_pref(${builtins.toJSON k},") desktopKeys)}) "$prof/prefs.js" > "$prof/prefs.js.sfn" || true
|
||||
if [ -f "$prof/prefs.js" ] && grep -qF "$pats" "$prof/prefs.js"; then
|
||||
grep -vF "$pats" "$prof/prefs.js" > "$prof/prefs.js.sfn" || true
|
||||
cat "$prof/prefs.js.sfn" > "$prof/prefs.js"
|
||||
rm -f "$prof/prefs.js.sfn"
|
||||
fi
|
||||
|
||||
@@ -70,15 +70,10 @@ let
|
||||
default = false;
|
||||
description = ''
|
||||
Give the patch one persistent JSON value (e.g. choices made in its
|
||||
UI), kept by the service in
|
||||
$XDG_STATE_HOME/steam-frame-nix/ui-patches/<name>.json across
|
||||
SteamVR restarts and reboots: the page reads it with
|
||||
`window.__sfuiStore.get(name)` and writes it with
|
||||
`window.__sfuiStore.set(name, value)` (see injector.mjs). The file
|
||||
is kept when the patch is disabled or removed (the choices come
|
||||
back when it is enabled again) and removed by
|
||||
`steam-frame-nix-cleanup --all` (also run by `install.sh
|
||||
uninstall`).
|
||||
UI): `window.__sfuiStore.get(name)` / `.set(name, value)` in the
|
||||
page, kept in $XDG_STATE_HOME/steam-frame-nix/ui-patches/<name>.json
|
||||
across SteamVR restarts, reboots and disabling the patch; removed
|
||||
by `steam-frame-nix-cleanup --all`.
|
||||
'';
|
||||
};
|
||||
};
|
||||
@@ -106,9 +101,9 @@ in {
|
||||
defaultText = lib.literalMD "the helpers of `modules/lib`";
|
||||
description = ''
|
||||
Patch helpers from modules/lib/default.nix: `mkPatch { name, src,
|
||||
signatures ? …, opts ? { } }` (calls `src` as
|
||||
`(find, sigs, opts, hooks) => …`; see there), plus `finders`, `hooks`
|
||||
(paths) and `signatures` (parsed signatures.json).
|
||||
signatures ? …, opts ? { }, extraArgs ? [ ] }` (calls `src` as
|
||||
`(find, sigs, opts, hooks, ...extraArgs) => …`; see there), plus
|
||||
`finders`, `hooks` (paths) and `signatures` (parsed signatures.json).
|
||||
'';
|
||||
};
|
||||
|
||||
|
||||
Reference in new issue
Block a user