mirror of
https://github.com/lhns/steam-frame-nix.git
synced 2026-10-06 01:00:13 +02:00
Neither Valve backend (gamescope, holo) implements FileChooser, so sandboxed apps fell back to an in-sandbox dialog without the home dir (e.g. Element's Attachments). session.portalFix.fileChooser (on) links kde.portal into the Steam session's portal dir and selects kde for FileChooser; xdg-desktop-portal-kde is D-Bus activated with DISPLAY=:0. Flake check for the portal config.
37 lines
1.4 KiB
Nix
37 lines
1.4 KiB
Nix
# Evaluates the portal module against a stub of Home Manager's options: on by
|
|
# default the Steam session's portal config picks KDE's FileChooser, with
|
|
# `fileChooser = false` it has neither the kde.portal link nor that line.
|
|
{ pkgs }:
|
|
let
|
|
inherit (pkgs) lib;
|
|
dir = "xdg-desktop-portal/gamescope-portals";
|
|
eval = cfg: (lib.evalModules {
|
|
modules = [
|
|
../portal.nix
|
|
{
|
|
options.xdg.dataFile = lib.mkOption {
|
|
type = lib.types.attrsOf (lib.types.attrsOf lib.types.anything);
|
|
default = { };
|
|
};
|
|
options.lib = lib.mkOption { type = lib.types.attrsOf lib.types.anything; };
|
|
config = {
|
|
_module.check = false; # Home Manager options the stub doesn't declare
|
|
_module.args.pkgs = pkgs;
|
|
lib.file.mkOutOfStoreSymlink = p: "out-of-store:${p}";
|
|
};
|
|
}
|
|
cfg
|
|
];
|
|
}).config.xdg.dataFile;
|
|
on = eval { };
|
|
off = eval { steamFrame.session.portalFix.fileChooser = false; };
|
|
kde = "org.freedesktop.impl.portal.FileChooser=kde";
|
|
in
|
|
assert on."${dir}/kde.portal".source
|
|
== "out-of-store:/usr/share/xdg-desktop-portal/portals/kde.portal";
|
|
assert lib.hasInfix kde on."${dir}/gamescope-portals.conf".text;
|
|
assert !(off ? "${dir}/kde.portal");
|
|
assert !(lib.hasInfix kde off."${dir}/gamescope-portals.conf".text);
|
|
assert off ? "${dir}/holo.portal";
|
|
pkgs.runCommand "portal-check" { } "touch $out"
|