yazi file picker

This commit is contained in:
Lennart J. Kurzweg (Nx2)
2025-07-20 01:08:57 +02:00
parent dd3b850221
commit da268cd46a
3 changed files with 55 additions and 10 deletions

View File

@@ -2,6 +2,9 @@
# browser.tabs.allow_transparent_browser
# https://www.reddit.com/r/FirefoxCSS/comments/1dqws4b/firefox_128_will_allow_the_main_browser_content/
{
programs.firefox.profiles."{hyper.user}".settings = {
"widget.use-xdg-desktop-portal.file-picker" = 1;
};
home = {
packages = with pkgs; [
firefox

View File

@@ -63,23 +63,16 @@ let
};
};
in {
home.packages = (with pkgs; [
# hyprland itself is a system package
home.packages = with pkgs; [
hyprland-protocols
hyprlock
hypridle
hyprshot
hyprpicker
hyprcursor
grim
slurp
# ]) ++ (with pkgs-unstable; [
# ]) ++ (with inputs; [
# hyprswitch.packages.x86_64-linux.default
]);
];
wayland.windowManager.hyprland = {
@@ -324,6 +317,11 @@ in {
"tile, class:^(sent)$"
"workspace 100, class:^(gamescope)$"
"float, title:^(terminal-file-picker)$"
"dimaround, title:^(terminal-file-picker)$"
"center, title:^(terminal-file-picker)$"
"size 80% 80%, title:^(terminal-file-picker)$"
];

View File

@@ -10,7 +10,27 @@
package = inputs.yazi.packages.${hyper.system}.default;
enableFishIntegration = true;
shellWrapperName = "ya";
# plugins = with inputs.yazi-plugins.packages.${hyper.system}; { };
initLua = /* lua */ ''
require("zoxide"):setup {
update_db = true,
}
Status:children_add(function()
local h = cx.active.current.hovered
if not h or ya.target_family() ~= "unix" then
return ""
end
return ui.Line {
ui.Span(ya.user_name(h.cha.uid) or tostring(h.cha.uid)):fg("magenta"),
":",
ui.Span(ya.group_name(h.cha.gid) or tostring(h.cha.gid)):fg("magenta"),
" ",
}
end, 500, Status.RIGHT)
'';
plugins = with pkgs; {
inherit glow git;
};
# initLua = /* lua */ '' '';
keymap = {
mgr.keymap = [
@@ -69,6 +89,8 @@
{ on = "O"; run = "open --interactive"; desc = "Open selected files interactively"; }
{ on = "<Enter>"; run = "open"; desc = "Open selected files"; }
{ on = "<S-Enter>"; run = "open --interactive"; desc = "Open selected files interactively"; }
{ on = "y"; run = [ ''shell -- for path in "$@"; do echo "file://$path"; done | wl-copy -t text/uri-list''
"yank" ]; desc = "Yank selected files (copy)"; }
{ on = "y"; run = "yank"; desc = "Yank selected files (copy)"; }
{ on = "x"; run = "yank --cut"; desc = "Yank selected files (cut)"; }
{ on = "p"; run = "paste"; desc = "Paste yanked "; }
@@ -373,4 +395,26 @@
};
};
};
xdg = {
configFile."xdg-desktop-portal-termfilechooser/config".text = lib.mkIf config.programs.yazi.enable ''
[filechooser]
cmd=${pkgs.xdg-desktop-portal-termfilechooser}/share/xdg-desktop-portal-termfilechooser/yazi-wrapper.sh
env=TERMCMD=ghostty --title="terminal-file-picker -e"
default_dir=$HOME
open_mode=suggested
save_mode=last
'';
portal = {
enable = true;
extraPortals = [ pkgs.xdg-desktop-portal-termfilechooser ];
config = {
common = {
"org.freedesktop.impl.portal.FileChooser" = "termfilechooser";
};
};
};
};
home.sessionVariables = {
GTK_USE_PORTAL = "1";
};
}