diff --git a/apps/hyprland/hypr/rules.nix b/apps/hyprland/hypr/rules.nix index b02cc05..9bb5448 100644 --- a/apps/hyprland/hypr/rules.nix +++ b/apps/hyprland/hypr/rules.nix @@ -4,6 +4,9 @@ ]; windowrulev2 = [ + "float, class:^(yazi-file-picker)$" + "size 60% 60%, class:^(yazi-file-picker)$" + "center, class:^(yazi-file-picker)$" ]; }; } diff --git a/apps/yazi/default.nix b/apps/yazi/default.nix index 5d8dd48..ca86cf2 100644 --- a/apps/yazi/default.nix +++ b/apps/yazi/default.nix @@ -1,4 +1,15 @@ -{pkgs, ...}: { +{ + pkgs, + myConfig, + ... +}: let + yazi-file-picker = pkgs.writeShellScriptBin "yazi-file-picker" '' + path="$1" + # multiple="$2" + # directory="$3" + ${pkgs.yazi}/bin/yazi --chooser-file="$path" + ''; +in { programs.yazi = { enable = true; enableFishIntegration = true; @@ -11,4 +22,11 @@ }; }; }; + + home.packages = [yazi-file-picker]; + + xdg.configFile."xdg-desktop-portal-termfilechooser/config".text = '' + [filechooser] + cmd=${pkgs.ghostty}/bin/ghostty --class=yazi-file-picker -e ${yazi-file-picker}/bin/yazi-file-picker + ''; } diff --git a/modules/nixos/hyprland.nix b/modules/nixos/hyprland.nix index f19a764..978795b 100644 --- a/modules/nixos/hyprland.nix +++ b/modules/nixos/hyprland.nix @@ -24,4 +24,18 @@ default = ["${myConfig.terminal.default}"]; }; }; + + xdg.portal = { + enable = true; + extraPortals = [ + pkgs.xdg-desktop-portal-termfilechooser + pkgs.xdg-desktop-portal-gtk + ]; + config = { + common = { + default = ["gtk"]; + "org.freedesktop.impl.portal.FileChooser" = ["termfilechooser"]; + }; + }; + }; } \ No newline at end of file