feat(yazi): enable yazi as system-wide file chooser
Configure xdg-desktop-portal-termfilechooser to use yazi (via ghostty) for file selection dialogs in portal-aware apps like Firefox. Includes a wrapper script and Hyprland window rules.
This commit is contained in:
@@ -4,6 +4,9 @@
|
||||
];
|
||||
|
||||
windowrulev2 = [
|
||||
"float, class:^(yazi-file-picker)$"
|
||||
"size 60% 60%, class:^(yazi-file-picker)$"
|
||||
"center, class:^(yazi-file-picker)$"
|
||||
];
|
||||
};
|
||||
}
|
||||
|
||||
+19
-1
@@ -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
|
||||
'';
|
||||
}
|
||||
|
||||
@@ -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"];
|
||||
};
|
||||
};
|
||||
};
|
||||
}
|
||||
Reference in New Issue
Block a user