diff options
Diffstat (limited to 'modules/by-name/xd/xdg/module.nix')
-rw-r--r-- | modules/by-name/xd/xdg/module.nix | 52 |
1 files changed, 27 insertions, 25 deletions
diff --git a/modules/by-name/xd/xdg/module.nix b/modules/by-name/xd/xdg/module.nix index 5140a832..1202cd96 100644 --- a/modules/by-name/xd/xdg/module.nix +++ b/modules/by-name/xd/xdg/module.nix @@ -1,36 +1,28 @@ { pkgs, - nixpkgs_open_prs, - sysLib, - system, + lib, ... }: let - pkgs_tfc = nixpkgs_open_prs.nixpkgs-tfc.legacyPackages."${system}"; + cmd = pkgs.writeShellApplication { + name = "lf_wrapper"; + + runtimeInputs = [pkgs.lf pkgs.alacritty]; + inheritPath = true; + + text = builtins.readFile ./lf-wrapper.sh; + }; + + tfcConfigFile = (pkgs.formats.ini {}).generate "xdg-desktop-portal-termfilechooser.ini" { + filechooser = { + default_dir = "/tmp"; + cmd = "${lib.getExe cmd}"; + }; + }; in { services.dbus.enable = true; xdg = { portal = { enable = true; - termfilechooser = { - enable = true; - logLevel = "TRACE"; - package = pkgs_tfc.xdg-desktop-portal-termfilechooser; - settings = { - filechooser = { - default_dir = "/tmp"; - cmd = "${sysLib.writeShellScript { - src = ./scripts/lf_wrapper.sh; - name = "lf_wrapper"; - keepPath = true; - dependencies = with pkgs; [ - lf - alacritty - bash - ]; - }}/bin/lf_wrapper"; - }; - }; - }; wlr = { enable = true; }; @@ -47,12 +39,22 @@ in { "org.freedesktop.impl.portal.FileChooser" = ["termfilechooser"]; }; }; + extraPortals = [ pkgs.xdg-desktop-portal-gtk pkgs.xdg-desktop-portal-wlr - pkgs_tfc.xdg-desktop-portal-termfilechooser + pkgs.xdg-desktop-portal-termfilechooser ]; }; }; + + environment.etc."xdg/xdg-desktop-portal-termfilechooser/config".source = tfcConfigFile; + + systemd.user.services.xdg-desktop-portal-termfilechooser = { + serviceConfig.ExecStart = [ + "" + "${pkgs.xdg-desktop-portal-termfilechooser}/libexec/xdg-desktop-portal-termfilechooser --loglevel=TRACE" + ]; + }; # TODO: mime = {}; } |